feat: Change rank based on time left
This commit is contained in:
parent
1efde00f1e
commit
4f601ec9f7
18
player.gd
18
player.gd
|
|
@ -9,6 +9,13 @@ const SLOW_MULT = 0.5
|
|||
const STAMINA_COST = 15
|
||||
const STAMINA_RECOVER = 10
|
||||
|
||||
const SCORE_RANK = {
|
||||
"C": { "time": 10, "money": 500, "color": Color.BROWN },
|
||||
"B": { "time": 20, "money": 1000, "color": Color.PURPLE },
|
||||
"A": { "time": 30, "money": 1500, "color": Color.GREEN },
|
||||
"S": { "time": 999, "money": 2000, "color": Color.YELLOW },
|
||||
}
|
||||
|
||||
var pedestrian_area_count = 0
|
||||
|
||||
var max_stamina: float = BASE_STAMINA
|
||||
|
|
@ -61,9 +68,18 @@ func _on_area_area_entered(area: Area3D) -> void:
|
|||
if area.name == "StationArea":
|
||||
$FinishControl.visible = true
|
||||
$HUD.visible = false
|
||||
var scoreLbl = $FinishControl/ScoreLabel
|
||||
for letter in SCORE_RANK:
|
||||
var rank = SCORE_RANK[letter]
|
||||
if $TimeLimit.time_left > rank["time"]:
|
||||
continue
|
||||
|
||||
scoreLbl.text = letter
|
||||
scoreLbl.add_theme_color_override("font_color", rank["color"])
|
||||
break
|
||||
|
||||
$TimeLimit.stop()
|
||||
|
||||
|
||||
func _on_area_area_exited(area: Area3D) -> void:
|
||||
if area.name == "PedestrianArea":
|
||||
pedestrian_area_count -= 1
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ offset_bottom = 4.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "Diners guanyat:
|
||||
Diners total:"
|
||||
|
|
|
|||
Loading…
Reference in New Issue