#46 ajout d'une borne de recharge et changements mineurs du gameplay
This commit is contained in:
@@ -3,7 +3,11 @@ class_name Planet
|
||||
|
||||
signal planet_updated(planet : Planet)
|
||||
signal day_limit_exceed(planet : Planet)
|
||||
signal pass_day_started(planet : Planet)
|
||||
signal pass_day_proceeded(planet : Planet)
|
||||
signal pass_day_ended(planet : Planet)
|
||||
|
||||
const PASS_DAY_ANIMATION_TIME : float = 1.5
|
||||
const DAY_LIMIT : int = 10
|
||||
const PLANET_TEXTURE_SCALE : float = 5.0
|
||||
|
||||
@@ -115,11 +119,28 @@ func is_there_contamination(point : Vector2) -> bool:
|
||||
return terrainData.get_contamination(point) < 0.5
|
||||
|
||||
func pass_day():
|
||||
for e : Node2D in entityContainer.get_children():
|
||||
if e.has_method("_start_pass_day"):
|
||||
e._start_pass_day()
|
||||
pass_day_started.emit(self)
|
||||
await get_tree().create_timer(PASS_DAY_ANIMATION_TIME/2.).timeout
|
||||
|
||||
generate_loot()
|
||||
pass_day_proceeded.emit(self)
|
||||
day += 1
|
||||
for e : Node2D in entityContainer.get_children():
|
||||
if e.has_method("_pass_day"):
|
||||
e._pass_day()
|
||||
generate_loot()
|
||||
|
||||
pass_day_ended.emit(self)
|
||||
await get_tree().create_timer(PASS_DAY_ANIMATION_TIME/2.).timeout
|
||||
for e : Node2D in entityContainer.get_children():
|
||||
if e.has_method("_end_pass_day"):
|
||||
e._end_pass_day()
|
||||
|
||||
decontamination_coverage = terrainData.get_decontamination_coverage()
|
||||
if day + 1 > DAY_LIMIT:
|
||||
day_limit_exceed.emit(self)
|
||||
|
||||
func generate_loot(number : int = loot_number.pick_random()):
|
||||
for i in range(number):
|
||||
@@ -137,11 +158,3 @@ func generate_loot(number : int = loot_number.pick_random()):
|
||||
)
|
||||
|
||||
#endregion
|
||||
|
||||
func _on_root_gui_day_pass_proceed():
|
||||
pass_day()
|
||||
|
||||
func _on_root_gui_day_pass_finished():
|
||||
decontamination_coverage = terrainData.get_decontamination_coverage()
|
||||
if day + 1 > DAY_LIMIT:
|
||||
day_limit_exceed.emit(self)
|
||||
|
||||
Reference in New Issue
Block a user