rework l'ui et équilibrage général
This commit is contained in:
@@ -25,7 +25,7 @@ alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="LanguageChoose/CenterContainer"]
|
||||
layout_mode = 2
|
||||
text = "Choose a language"
|
||||
text = "CHOOSE_A_LANGUAGE"
|
||||
label_settings = ExtResource("3_mi20s")
|
||||
horizontal_alignment = 1
|
||||
|
||||
@@ -36,6 +36,7 @@ theme = ExtResource("1_u726n")
|
||||
alignment = 1
|
||||
|
||||
[node name="Story" type="CanvasLayer" parent="."]
|
||||
visible = false
|
||||
script = ExtResource("5_tg2p4")
|
||||
|
||||
[node name="CenterContainer2" type="CenterContainer" parent="Story"]
|
||||
|
||||
@@ -46,8 +46,14 @@ func generate_contamination_terrain_sprite() -> Polygon2D:
|
||||
|
||||
func get_score():
|
||||
var score = 0
|
||||
for p in plants:
|
||||
score += p.calculate_plant_score()
|
||||
planet_data.score_by_plant.resize(len(plants))
|
||||
for i in range(len(plants)):
|
||||
var plant_score = plants[i].calculate_plant_score()
|
||||
score += plant_score
|
||||
var old_score = 0 if planet_data.score_by_plant[i] == null else planet_data.score_by_plant[i]
|
||||
if old_score < plant_score:
|
||||
planet_data.plant_has_gained_score(plants[i], plant_score - old_score)
|
||||
planet_data.score_by_plant[i] = plant_score
|
||||
return score
|
||||
|
||||
func plant(
|
||||
@@ -62,7 +68,6 @@ func plant(
|
||||
plants.append(new_plant)
|
||||
new_plant.harvested.connect(_on_plant_harvested)
|
||||
new_plant.state_changed.connect(_on_plant_state_changed)
|
||||
update_garden_score()
|
||||
return new_plant
|
||||
|
||||
func _on_plant_state_changed(_p: Plant):
|
||||
|
||||
@@ -116,6 +116,7 @@ func plant(
|
||||
if garden.is_in_garden(plant_position):
|
||||
var new_plant = garden.plant(type, plant_mutations)
|
||||
add_entity(new_plant, plant_position)
|
||||
garden.update_garden_score()
|
||||
return true
|
||||
return false
|
||||
|
||||
@@ -166,6 +167,7 @@ func reach_quota():
|
||||
data.quota += 1
|
||||
quota_reward.trigger_reward()
|
||||
await quota_reward.reward_chosen
|
||||
garden.update_garden_score()
|
||||
if data.garden_score >= data.get_quota_score():
|
||||
reach_quota()
|
||||
data.quota_days = data.get_quota_duration()
|
||||
|
||||
@@ -2,6 +2,7 @@ extends Resource
|
||||
class_name PlanetData
|
||||
|
||||
signal new_quota_started(planet_data : PlanetData)
|
||||
signal plant_gaining_score(p : Plant, amount : int)
|
||||
signal contamination_updated(decontamination_surface : float)
|
||||
signal updated(planet_data : PlanetData)
|
||||
|
||||
@@ -27,6 +28,7 @@ const DEFAULT_GARDEN_SIZE = Vector2(1500,1500)
|
||||
quota_days = v
|
||||
updated.emit(self)
|
||||
@export var entities_saved_data : Array[EntityData] = []
|
||||
@export var score_by_plant : Array[int] = []
|
||||
@export var generated_chunk_entities : Array[Vector2i]
|
||||
@export var tutorial_step : int = 0
|
||||
|
||||
@@ -41,7 +43,7 @@ func _init(_base_size : Vector2 = DEFAULT_GARDEN_SIZE):
|
||||
)
|
||||
contamination_updated.emit(get_decontamination_surface())
|
||||
|
||||
|
||||
#region ------------------ Contamination ------------------
|
||||
func impact_contamination(position : Vector2, impact_radius : float, to_value : float = 1.):
|
||||
garden_contamination.draw_circle(
|
||||
position,
|
||||
@@ -66,6 +68,8 @@ func get_decontamination_coverage() -> float:
|
||||
func get_decontamination_surface() -> float:
|
||||
return garden_contamination.get_value_surface()
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Quotas ------------------
|
||||
func get_quota_score(q : int = quota) -> int:
|
||||
var first_quotas = [
|
||||
@@ -85,4 +89,11 @@ func get_quota_duration(_q = quota) -> int:
|
||||
return 7
|
||||
|
||||
#endregion
|
||||
|
||||
#region ------------------ Score ------------------
|
||||
|
||||
func plant_has_gained_score(plant : Plant, amount : int):
|
||||
plant_gaining_score.emit(plant, amount)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func draw_random_zone(
|
||||
var noise: Noise = FastNoiseLite.new()
|
||||
noise.seed = random_seed
|
||||
noise.noise_type = FastNoiseLite.TYPE_CELLULAR
|
||||
noise.frequency = 0.3
|
||||
noise.frequency = 0.1
|
||||
|
||||
var noise_image_size : Vector2i = Vector2i.ONE * (image_size)
|
||||
var noise_image_center = noise_image_size / 2
|
||||
|
||||
@@ -39,9 +39,9 @@ scale = Vector2(0.5539248, 0.5539248)
|
||||
position = Vector2(47, 497.00003)
|
||||
scale = Vector2(0.5539248, 0.5539248)
|
||||
script = ExtResource("3_fk6sc")
|
||||
default_interact_text = "Exit the truck"
|
||||
default_info_title = "Exit"
|
||||
default_info_desc = "A good old ladder."
|
||||
default_interact_text = "EXIT_TRUCK"
|
||||
default_info_title = "EXIT"
|
||||
default_info_desc = "LADDER_DESC_TEXT"
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Exit"]
|
||||
|
||||
Reference in New Issue
Block a user