ajout du déblocage/évolutions des plantes (#89) et fix divers
This commit is contained in:
@@ -21,7 +21,6 @@ func _init():
|
||||
@export var truck_data : TruckData = TruckData.new()
|
||||
|
||||
func set_default_unlocked():
|
||||
unlocked_plant_types = all_plant_types()
|
||||
unlocked_plant_mutations = all_plant_mutations()
|
||||
unlocked_machines = all_machines()
|
||||
|
||||
@@ -39,6 +38,25 @@ func reset_all():
|
||||
reset_player()
|
||||
reset_truck()
|
||||
|
||||
unlocked_plant_types = []
|
||||
|
||||
func unlock_plant_type(new_plant_type : PlantType):
|
||||
if not is_plant_type_unlocked(new_plant_type):
|
||||
unlocked_plant_types.append(new_plant_type.duplicate_deep())
|
||||
|
||||
func get_locked_plant_types() -> Array[PlantType]:
|
||||
var locked_plant_type : Array[PlantType] = []
|
||||
|
||||
for pt in GameInfo.game_data.all_plant_types():
|
||||
if not is_plant_type_unlocked(pt):
|
||||
locked_plant_type.append(pt)
|
||||
|
||||
return locked_plant_type
|
||||
|
||||
func is_plant_type_unlocked(new_plant_type : PlantType):
|
||||
return unlocked_plant_types.find_custom(
|
||||
func (upt : PlantType): return new_plant_type.name == upt.name
|
||||
) != -1
|
||||
|
||||
|
||||
func all_plant_types() -> Array[PlantType]:
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/ambiance_phase_1.ogg-4ec046572bfe46745950c2c7
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -12,7 +12,7 @@ dest_files=["res://.godot/imported/ambiance_phase_2.ogg-2260c3829d7e53dd94462ea7
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/ambiance_phase_3.ogg-b221fd161951d0874f6a08d4
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/forest_phase_1.ogg-6bf54bf177c3c359a54aab9723
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/forest_phase_2.ogg-0fc72a5b1a0f8f7e98246db80e
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/truck_music.ogg-cb4f770bcd6358719b9d817459f5f
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -48,7 +48,6 @@ func get_all_audio_stream() -> Array[AudioStreamPlayer]:
|
||||
var all_children = %Ambiance.get_children()
|
||||
all_children.append_array(%Musics.get_children())
|
||||
|
||||
print(all_children)
|
||||
for c in all_children:
|
||||
if c is AudioStreamPlayer:
|
||||
all_audio_stream.append(c)
|
||||
@@ -60,9 +59,9 @@ func _on_current_planet_data_updated(planet_data : PlanetData):
|
||||
planet_data.updated.connect(update_garden_phase)
|
||||
|
||||
func update_garden_phase(planet_data : PlanetData):
|
||||
var phase : int = 0
|
||||
var phase : int = garden_phase
|
||||
for i in range(len(garden_phases_scores)):
|
||||
if planet_data.garden_score >= garden_phases_scores[i]:
|
||||
if planet_data.garden_score >= garden_phases_scores[i] and i > garden_phase:
|
||||
phase = i
|
||||
|
||||
update_phase()
|
||||
|
||||
Reference in New Issue
Block a user