20 lines
614 B
GDScript
20 lines
614 B
GDScript
extends Node
|
|
|
|
func _ready() -> void:
|
|
EventBus.role_changed.connect(_on_role_changed)
|
|
|
|
func _process(delta: float) -> void:
|
|
if PlayerData.gcd > 0:
|
|
PlayerData.gcd -= delta
|
|
if PlayerData.aa_timer > 0:
|
|
PlayerData.aa_timer -= delta
|
|
for i in range(PlayerData.cooldowns.size()):
|
|
if PlayerData.cooldowns[i] > 0:
|
|
PlayerData.cooldowns[i] -= delta
|
|
EventBus.cooldown_tick.emit(PlayerData.cooldowns, PlayerData.max_cooldowns, PlayerData.gcd)
|
|
|
|
func _on_role_changed(_player: Node, _role_type: int) -> void:
|
|
PlayerData.cooldowns.fill(0.0)
|
|
PlayerData.max_cooldowns.fill(0.0)
|
|
PlayerData.gcd = 0.0
|