2024-01-16 22:01:16 +00:00
|
|
|
class_name Player
|
2024-02-07 22:04:19 +00:00
|
|
|
extends CharacterBody3D
|
|
|
|
|
2024-02-13 22:12:32 +00:00
|
|
|
signal skill_used(skill: Skill)
|
2024-02-07 22:04:19 +00:00
|
|
|
signal dashed
|
|
|
|
signal jumped
|
2024-02-12 23:22:27 +00:00
|
|
|
signal name_changed(new_name: String)
|
2024-02-07 22:04:19 +00:00
|
|
|
signal direction_changed
|
|
|
|
|
2024-02-13 22:12:32 +00:00
|
|
|
@export var skills: Array[Skill]
|
|
|
|
|
2024-02-12 23:22:27 +00:00
|
|
|
var id: String
|
2024-02-07 22:04:19 +00:00
|
|
|
var controller: Controller
|
|
|
|
|
2024-02-13 20:04:35 +00:00
|
|
|
func use_skill(slot: int):
|
2024-02-15 12:45:17 +00:00
|
|
|
if get_node("State").current == StateComponent.State.Skill:
|
|
|
|
return
|
|
|
|
|
2024-02-13 22:12:32 +00:00
|
|
|
skill_used.emit(skills[slot])
|
2024-02-07 22:04:19 +00:00
|
|
|
|
|
|
|
func jump():
|
|
|
|
jumped.emit()
|
|
|
|
|
|
|
|
func set_direction(direction: Vector3):
|
|
|
|
direction_changed.emit(direction)
|
|
|
|
|
2024-02-12 23:22:27 +00:00
|
|
|
func set_player_name(new_name: String):
|
2024-01-25 23:29:05 +00:00
|
|
|
name = new_name
|
2024-02-12 23:22:27 +00:00
|
|
|
name_changed.emit(new_name)
|