équilibrage des quota et du jeu, changement du GUI pour rendre les objectifs de quotas plus visibles #72
This commit is contained in:
@@ -59,6 +59,9 @@ following = NodePath("../Entities/Player")
|
||||
[connection signal="pause_asked" from="CanvasLayer/RootGui" to="CanvasLayer/Pause" method="_on_root_gui_pause_asked"]
|
||||
[connection signal="player_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_updated"]
|
||||
[connection signal="upgraded" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_upgraded"]
|
||||
[connection signal="day_limit_exceed" from="Planet" to="CanvasLayer/Win" method="_on_planet_day_limit_exceed"]
|
||||
[connection signal="new_quota_started" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_new_quota_started"]
|
||||
[connection signal="pass_day_ended" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_pass_day_ended"]
|
||||
[connection signal="pass_day_started" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_pass_day_started"]
|
||||
[connection signal="planet_updated" from="Planet" to="CanvasLayer/RootGui" method="_on_planet_updated"]
|
||||
[connection signal="quota_reward_asked" from="Planet" to="CanvasLayer/RewardChoice" method="_on_planet_quota_reward_asked"]
|
||||
|
||||
@@ -7,9 +7,10 @@ signal pass_day_started(planet : Planet)
|
||||
signal pass_day_proceeded(planet : Planet)
|
||||
signal pass_day_ended(planet : Planet)
|
||||
signal quota_reward_asked(planet : Planet, item1 : Item, item2 : Item)
|
||||
signal new_quota_started(planet : Planet)
|
||||
|
||||
const PASS_DAY_ANIMATION_TIME : float = 1.5
|
||||
const DEFAULT_DAY_LIMIT : int = 10
|
||||
const DEFAULT_DAY_LIMIT : int = 7
|
||||
const PLANET_TEXTURE_SCALE : float = 5.0
|
||||
const OBJECTIVE_MAX_LEVEL : int = 10
|
||||
const OBJECTIVE_MIN_ANGLE_DIFF = PI/2
|
||||
@@ -40,8 +41,9 @@ var planet_data : PlanetData
|
||||
var contamination_texture : ImageTexture
|
||||
var day : int = 1
|
||||
var day_limit = DEFAULT_DAY_LIMIT
|
||||
var surface_on_last_quota : float = 0
|
||||
var next_quota : float = 1
|
||||
var days_on_last_quota : int = 0
|
||||
var last_quota : float = 0
|
||||
var next_quota : float
|
||||
var player : Player
|
||||
|
||||
func _ready():
|
||||
@@ -54,12 +56,13 @@ func _ready():
|
||||
decontamination_surface = planet_data.get_decontamination_surface()
|
||||
|
||||
next_quota = planet_data.get_quota()
|
||||
surface_on_last_quota = decontamination_surface
|
||||
days_on_last_quota = day
|
||||
|
||||
generate_loot(first_loot_number)
|
||||
generate_objectives()
|
||||
planet_updated.emit(self)
|
||||
|
||||
new_quota_started.emit(self)
|
||||
|
||||
# queue_redraw()
|
||||
|
||||
@@ -198,11 +201,11 @@ func pass_day():
|
||||
e._end_pass_day()
|
||||
|
||||
decontamination_surface = planet_data.get_decontamination_surface()
|
||||
if day + 1 > day_limit:
|
||||
day_limit_exceed.emit(self)
|
||||
|
||||
if decontamination_surface >= next_quota:
|
||||
ask_quota_reward()
|
||||
reach_quota()
|
||||
|
||||
if get_quota_remaining_days() <= 0:
|
||||
day_limit_exceed.emit(self)
|
||||
|
||||
planet_updated.emit(self)
|
||||
|
||||
@@ -248,11 +251,15 @@ func generate_objective(distance : int, angle : float, reward : ObjectiveReward)
|
||||
|
||||
objective.position = Vector2.ONE.rotated(angle) * distance
|
||||
|
||||
func ask_quota_reward():
|
||||
func reach_quota():
|
||||
planet_data.quota_number += 1
|
||||
last_quota = next_quota
|
||||
next_quota = planet_data.get_quota(planet_data.quota_number)
|
||||
surface_on_last_quota = decontamination_surface
|
||||
days_on_last_quota = day
|
||||
|
||||
ask_quota_reward()
|
||||
|
||||
func ask_quota_reward():
|
||||
quota_reward_asked.emit(
|
||||
self,
|
||||
generate_quota_reward(),
|
||||
@@ -273,6 +280,11 @@ func generate_quota_reward() -> Item:
|
||||
func choose_quota_reward(item : Item):
|
||||
drop_item(item, player.global_position, 100)
|
||||
if decontamination_surface >= next_quota:
|
||||
ask_quota_reward()
|
||||
reach_quota()
|
||||
else :
|
||||
new_quota_started.emit(self)
|
||||
|
||||
func get_quota_remaining_days():
|
||||
return DEFAULT_DAY_LIMIT - (day - days_on_last_quota)
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user