2026-07-29 00:05:40 +02:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
var walking: bool = false
|
|
|
|
|
var running: bool = false
|
|
|
|
|
var crouching: bool = false
|
|
|
|
|
var in_menu: bool = false
|
2026-07-29 02:37:45 +02:00
|
|
|
var breathing_mode = breath.calm
|
|
|
|
|
|
|
|
|
|
enum breath {
|
|
|
|
|
calm,
|
|
|
|
|
low,
|
|
|
|
|
mid,
|
|
|
|
|
heavy,
|
|
|
|
|
max,
|
|
|
|
|
exhausted
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
## 0 --> exhausted [br]
|
|
|
|
|
## 0 - 10 --> max [br]
|
|
|
|
|
## 10 -- 20 --> heavy [br]
|
|
|
|
|
## 20 -- 50 --> mid [br]
|
|
|
|
|
## 50 -- 80 --> low [br]
|
|
|
|
|
## 80 -- 100 --> calm
|
|
|
|
|
var _breath_change_points: Array[float] = [10, 20, 50, 80]
|
|
|
|
|
|
2026-07-31 02:38:02 +02:00
|
|
|
@onready var player_manager: Node = %PlayerManager
|
|
|
|
|
@onready var player: CharacterBody3D = $"../.."
|
2026-07-30 01:44:27 +02:00
|
|
|
|
|
|
|
|
var flying: bool = false
|
|
|
|
|
signal landed
|
|
|
|
|
signal jumped
|
2026-07-29 02:37:45 +02:00
|
|
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
2026-07-31 02:38:02 +02:00
|
|
|
var stamina = player_manager.stamina
|
2026-07-29 02:37:45 +02:00
|
|
|
if stamina == 0:
|
|
|
|
|
breathing_mode = breath.exhausted
|
|
|
|
|
elif stamina <= _breath_change_points[0]:
|
|
|
|
|
breathing_mode = breath.max
|
|
|
|
|
elif stamina <= _breath_change_points[1]:
|
|
|
|
|
breathing_mode = breath.heavy
|
|
|
|
|
elif stamina <= _breath_change_points[2]:
|
|
|
|
|
breathing_mode = breath.mid
|
|
|
|
|
elif stamina <= _breath_change_points[3]:
|
|
|
|
|
breathing_mode = breath.low
|
|
|
|
|
else:
|
|
|
|
|
breathing_mode = breath.calm
|
2026-07-30 01:44:27 +02:00
|
|
|
|
|
|
|
|
if !player.is_on_floor() and !flying:
|
|
|
|
|
emit_signal("jumped", true)
|
|
|
|
|
flying = true
|
|
|
|
|
|
|
|
|
|
if player.is_on_floor() and flying:
|
|
|
|
|
emit_signal("landed", false)
|
|
|
|
|
flying = false
|
2026-07-29 00:05:40 +02:00
|
|
|
|
|
|
|
|
func is_crouched(yes:bool):
|
|
|
|
|
if yes:
|
|
|
|
|
crouching = true
|
|
|
|
|
walking = false
|
|
|
|
|
running = false
|
|
|
|
|
else:
|
|
|
|
|
crouching = false
|
|
|
|
|
|
|
|
|
|
func is_walking(yes:bool):
|
|
|
|
|
if yes:
|
|
|
|
|
crouching = false
|
|
|
|
|
walking = true
|
|
|
|
|
running = false
|
|
|
|
|
else:
|
|
|
|
|
walking = false
|
|
|
|
|
|
|
|
|
|
func is_running(yes:bool):
|
|
|
|
|
if yes:
|
|
|
|
|
crouching = false
|
|
|
|
|
walking = false
|
|
|
|
|
running = true
|
|
|
|
|
else:
|
|
|
|
|
running = false
|