Added state component
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
class_name SkillInstance
|
||||
extends Node3D
|
||||
extends Node
|
||||
|
||||
func play_animation(animation_name: String, duration: float, speed: float):
|
||||
var character := get_parent()
|
||||
var animation := character.get_node("Animation") as AnimationComponent
|
||||
animation.play_with_duration(animation_name, duration, speed)
|
||||
var state: StateComponent
|
||||
var animation: AnimationComponent
|
||||
|
||||
func melee_damage(wait_time: float):
|
||||
var area := get_node("Area")
|
||||
await get_tree().create_timer(wait_time).timeout
|
||||
area.monitoring = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
area.monitoring = false
|
||||
func _enter_tree():
|
||||
state = get_parent().get_node("State") as StateComponent
|
||||
animation = get_parent().get_node("Animation") as AnimationComponent
|
||||
state.current = StateComponent.State.Skill
|
||||
|
||||
func end():
|
||||
animation.player.speed_scale = 1.0
|
||||
state.current = state.next_state()
|
||||
queue_free()
|
Reference in New Issue
Block a user