State machine rework
This commit is contained in:
parent
3f99f1b8dd
commit
87919ed890
25 changed files with 102 additions and 76 deletions
|
|
@ -13,11 +13,11 @@ extends State
|
||||||
@export var crouch_time: float = 0.1
|
@export var crouch_time: float = 0.1
|
||||||
@export var weapon_system: WeaponSystem
|
@export var weapon_system: WeaponSystem
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
animation_player.play("crouch",-1,1/crouch_time)
|
animation_player.play("crouch",-1,1/crouch_time)
|
||||||
player_input.crouch_end.connect(try_end_crouch)
|
player_input.crouch_end.connect(try_end_crouch)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
animation_player.play("crouch",-1,-1/crouch_time,true)
|
animation_player.play("crouch",-1,-1/crouch_time,true)
|
||||||
player_input.crouch_end.disconnect(try_end_crouch)
|
player_input.crouch_end.disconnect(try_end_crouch)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ extends State
|
||||||
func on_death() -> void:
|
func on_death() -> void:
|
||||||
transition.emit("Death")
|
transition.emit("Death")
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
animation_player.play("die")
|
animation_player.play("die")
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ extends State
|
||||||
@export var weapon_system: WeaponSystem
|
@export var weapon_system: WeaponSystem
|
||||||
@export var land_sound: MultiplayerAudio3D
|
@export var land_sound: MultiplayerAudio3D
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@ extends State
|
||||||
|
|
||||||
var step_time: float
|
var step_time: float
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
player_input.jumped.connect(on_jumped)
|
player_input.jumped.connect(on_jumped)
|
||||||
player_input.crouch_begin.connect(begin_crouch)
|
player_input.crouch_begin.connect(begin_crouch)
|
||||||
player_input.walk_begin.connect(begin_walk)
|
player_input.walk_begin.connect(begin_walk)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
player_input.jumped.disconnect(on_jumped)
|
player_input.jumped.disconnect(on_jumped)
|
||||||
player_input.crouch_begin.disconnect(begin_crouch)
|
player_input.crouch_begin.disconnect(begin_crouch)
|
||||||
player_input.walk_begin.disconnect(begin_walk)
|
player_input.walk_begin.disconnect(begin_walk)
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ extends State
|
||||||
@export var player_input: PlayerInput
|
@export var player_input: PlayerInput
|
||||||
@export var weapon_system: WeaponSystem
|
@export var weapon_system: WeaponSystem
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
player_input.crouch_begin.connect(begin_crouch)
|
player_input.crouch_begin.connect(begin_crouch)
|
||||||
player_input.walk_end.connect(end_walk)
|
player_input.walk_end.connect(end_walk)
|
||||||
player_input.jumped.connect(on_jumped)
|
player_input.jumped.connect(on_jumped)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
player_input.crouch_begin.disconnect(begin_crouch)
|
player_input.crouch_begin.disconnect(begin_crouch)
|
||||||
player_input.walk_end.disconnect(end_walk)
|
player_input.walk_end.disconnect(end_walk)
|
||||||
player_input.jumped.disconnect(on_jumped)
|
player_input.jumped.disconnect(on_jumped)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ func on_transition_required(to: StringName):
|
||||||
return
|
return
|
||||||
|
|
||||||
change_state(states[to])
|
change_state(states[to])
|
||||||
change_state_to_name.rpc(to)
|
|
||||||
|
|
||||||
func change_state(to_state: State) -> void:
|
func change_state(to_state: State) -> void:
|
||||||
if current_state != null:
|
if current_state != null:
|
||||||
|
|
@ -31,19 +30,6 @@ func change_state(to_state: State) -> void:
|
||||||
current_state = to_state
|
current_state = to_state
|
||||||
current_state.enter()
|
current_state.enter()
|
||||||
|
|
||||||
@rpc("authority","call_local","reliable")
|
|
||||||
func change_state_to_name(to_name: StringName):
|
|
||||||
if current_state != null:
|
|
||||||
current_state.exit()
|
|
||||||
current_state = states[to_name]
|
|
||||||
current_state.enter()
|
|
||||||
|
|
||||||
@rpc("authority","call_local","unreliable")
|
|
||||||
func clear_state():
|
|
||||||
if current_state == null:
|
|
||||||
return
|
|
||||||
current_state.exit()
|
|
||||||
current_state = null
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if current_state == null:
|
if current_state == null:
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,21 @@ class_name State
|
||||||
|
|
||||||
signal transition(to: StringName)
|
signal transition(to: StringName)
|
||||||
|
|
||||||
@abstract func enter() -> void
|
@abstract func _enter() -> void
|
||||||
@abstract func exit() -> void
|
@abstract func _exit() -> void
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
|
func enter():
|
||||||
|
_enter()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
enter.rpc()
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
|
func exit():
|
||||||
|
_exit()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
exit.rpc()
|
||||||
|
|
||||||
func update(delta: float) -> void:
|
func update(delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
func physics_update(delta: float) -> void:
|
func physics_update(delta: float) -> void:
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,11 @@ class_name SubStateMachine
|
||||||
|
|
||||||
@export var enter_state: State
|
@export var enter_state: State
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
change_state(enter_state)
|
change_state(enter_state)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
if is_multiplayer_authority():
|
current_state.exit()
|
||||||
clear_state.rpc()
|
|
||||||
|
|
||||||
func update(delta: float) -> void:
|
func update(delta: float) -> void:
|
||||||
if current_state == null:
|
if current_state == null:
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,40 @@ signal return_to_previous
|
||||||
|
|
||||||
var machine: WeaponSubStateMachine
|
var machine: WeaponSubStateMachine
|
||||||
|
|
||||||
|
func _use_begin() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
func use_begin() -> void:
|
func use_begin() -> void:
|
||||||
|
_use_begin()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
use_begin.rpc()
|
||||||
|
|
||||||
|
func _use_end():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
func use_end() -> void:
|
func use_end() -> void:
|
||||||
|
_use_end()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
use_end.rpc()
|
||||||
|
|
||||||
|
func _alternate_state() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
func alternate_state() -> void:
|
func alternate_state() -> void:
|
||||||
pass
|
_alternate_state()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
alternate_state.rpc()
|
||||||
# Need to clarify naming; Switch mode like firemode. For different states use
|
# Need to clarify naming; Switch mode like firemode. For different states use
|
||||||
# alternate_state
|
# alternate_state
|
||||||
func switch_mode() -> void:
|
|
||||||
|
func _switch_mode():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@rpc("authority","call_remote","reliable")
|
||||||
|
func switch_mode() -> void:
|
||||||
|
_switch_mode()
|
||||||
|
if is_multiplayer_authority():
|
||||||
|
switch_mode.rpc()
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,11 @@ func _ready() -> void:
|
||||||
ammo_depleted.connect(system.check_for_empty)
|
ammo_depleted.connect(system.check_for_empty)
|
||||||
ammo_updated.connect(system.on_ammo_updated)
|
ammo_updated.connect(system.on_ammo_updated)
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
super()
|
super()
|
||||||
player.weapon_models[visibility_target].show()
|
player.weapon_models[visibility_target].show()
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
super()
|
super()
|
||||||
player.weapon_models[visibility_target].hide()
|
player.weapon_models[visibility_target].hide()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ func add(state: WeaponSubStateMachine, slot: StringName) -> void:
|
||||||
if current_state == null:
|
if current_state == null:
|
||||||
current_state = state
|
current_state = state
|
||||||
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
|
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
|
||||||
state.enter.call_deferred()
|
state._enter.call_deferred()
|
||||||
|
|
||||||
|
|
||||||
func process_spawned_weapon(weapon_node: Node):
|
func process_spawned_weapon(weapon_node: Node):
|
||||||
|
|
@ -83,13 +83,13 @@ func switch(to: StringName, exit: bool = true):
|
||||||
if slots.has(to) == false or slots[to] == null or slots[to] == current_state or (multiplayer.get_remote_sender_id() != 1 and is_multiplayer_authority() == false):
|
if slots.has(to) == false or slots[to] == null or slots[to] == current_state or (multiplayer.get_remote_sender_id() != 1 and is_multiplayer_authority() == false):
|
||||||
return
|
return
|
||||||
if current_state != null and exit:
|
if current_state != null and exit:
|
||||||
current_state.exit()
|
current_state._exit()
|
||||||
if current_state.can_be_previous:
|
if current_state.can_be_previous:
|
||||||
last_slot = slots.find_key(current_state)
|
last_slot = slots.find_key(current_state)
|
||||||
else:
|
else:
|
||||||
last_slot = ""
|
last_slot = ""
|
||||||
current_state = slots[to]
|
current_state = slots[to]
|
||||||
current_state.enter()
|
current_state._enter()
|
||||||
|
|
||||||
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
|
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
|
||||||
switched_to.emit(current_state)
|
switched_to.emit(current_state)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
extends WeaponState
|
extends WeaponState
|
||||||
|
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix+"idle")
|
machine.animation_player.play(machine.animation_prefix+"idle")
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
if Session.is_on_site(machine.player.player_id):
|
if Session.is_on_site(machine.player.player_id):
|
||||||
transition.emit("Plant")
|
transition.emit("Plant")
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
extends WeaponState
|
extends WeaponState
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix+"intro")
|
machine.animation_player.play(machine.animation_prefix+"intro")
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation: StringName):
|
func on_animation_finished(animation: StringName):
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@ extends WeaponState
|
||||||
|
|
||||||
@export var bomb_scene: PackedScene
|
@export var bomb_scene: PackedScene
|
||||||
|
|
||||||
func enter():
|
func _enter():
|
||||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority():
|
||||||
machine.speed_modifier = 0.0
|
machine.speed_modifier = 0.0
|
||||||
machine.player.get_node("PlantAudio").multiplayer_play()
|
machine.player.get_node("PlantAudio").multiplayer_play()
|
||||||
|
|
||||||
func exit():
|
func _exit():
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
machine.speed_modifier = 1.0
|
machine.speed_modifier = 1.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,19 @@ extends WeaponState
|
||||||
|
|
||||||
@export var emptyable: bool
|
@export var emptyable: bool
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(with_morphems("idle"))
|
machine.animation_player.play(with_morphems("idle"))
|
||||||
machine.player.get_node("PlayerInput").reload.connect(init_reload)
|
if is_multiplayer_authority():
|
||||||
|
machine.player.get_node("PlayerInput").reload.connect(init_reload)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.player.get_node("PlayerInput").reload.disconnect(init_reload)
|
if is_multiplayer_authority():
|
||||||
|
machine.player.get_node("PlayerInput").reload.disconnect(init_reload)
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
if machine.ammo > 0:
|
if machine.ammo > 0:
|
||||||
transition.emit("Shoot")
|
transition.emit("Shoot")
|
||||||
|
|
||||||
@rpc("authority","call_local","reliable")
|
|
||||||
func init_reload():
|
func init_reload():
|
||||||
if machine.ammo == machine.max_ammo or machine.remaining_ammo <= 0:
|
if machine.ammo == machine.max_ammo or machine.remaining_ammo <= 0:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ extends WeaponState
|
||||||
|
|
||||||
@export var emptyable: bool
|
@export var emptyable: bool
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(with_morphems("intro"))
|
machine.animation_player.play(with_morphems("intro"))
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ extends WeaponState
|
||||||
|
|
||||||
@export var emptyable: bool
|
@export var emptyable: bool
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(with_morphems("reload"))
|
machine.animation_player.play(with_morphems("reload"))
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ extends WeaponState
|
||||||
|
|
||||||
var bullets_shot: int = 0
|
var bullets_shot: int = 0
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
fire()
|
fire()
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
bullets_shot = 0
|
bullets_shot = 0
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ func on_animation_finished(animation):
|
||||||
if animation == with_morphems("shoot"):
|
if animation == with_morphems("shoot"):
|
||||||
transition.emit("Idle")
|
transition.emit("Idle")
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
if fire_timer.time_left > 0:
|
if fire_timer.time_left > 0:
|
||||||
return
|
return
|
||||||
fire()
|
fire()
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ extends WeaponState
|
||||||
@export var damage: int
|
@export var damage: int
|
||||||
var end_it: bool = true
|
var end_it: bool = true
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||||
attack()
|
attack()
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
end_it = false
|
end_it = false
|
||||||
|
|
||||||
|
|
@ -24,8 +24,8 @@ func on_animation_finished(animation):
|
||||||
attack()
|
attack()
|
||||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
end_it = false
|
end_it = false
|
||||||
|
|
||||||
func use_end() -> void:
|
func _use_end() -> void:
|
||||||
end_it = true
|
end_it = true
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ extends WeaponState
|
||||||
|
|
||||||
@export var damage: int
|
@export var damage: int
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix + "heavy_attack")
|
machine.animation_player.play(machine.animation_prefix + "heavy_attack")
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
attack()
|
attack()
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func attack() -> void:
|
func attack() -> void:
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
extends WeaponState
|
extends WeaponState
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix + "idle")
|
machine.animation_player.play(machine.animation_prefix + "idle")
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
transition.emit("Attack")
|
transition.emit("Attack")
|
||||||
|
|
||||||
func alternate_state() -> void:
|
func _alternate_state() -> void:
|
||||||
transition.emit("HeavyAttack")
|
transition.emit("HeavyAttack")
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
extends WeaponState
|
extends WeaponState
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix + "intro")
|
machine.animation_player.play(machine.animation_prefix + "intro")
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
extends WeaponState
|
extends WeaponState
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix +"idle")
|
machine.animation_player.play(machine.animation_prefix +"idle")
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func use_begin() -> void:
|
func _use_begin() -> void:
|
||||||
if machine.ammo > 0:
|
if machine.ammo > 0:
|
||||||
transition.emit("Throw")
|
transition.emit("Throw")
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ extends WeaponState
|
||||||
|
|
||||||
@export var emptyable: bool
|
@export var emptyable: bool
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
machine.animation_player.play(machine.animation_prefix + "intro")
|
machine.animation_player.play(machine.animation_prefix + "intro")
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ extends WeaponState
|
||||||
|
|
||||||
const molik: PackedScene = preload("uid://b6qahd6q60js7")
|
const molik: PackedScene = preload("uid://b6qahd6q60js7")
|
||||||
|
|
||||||
func enter() -> void:
|
func _enter() -> void:
|
||||||
fire()
|
fire()
|
||||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||||
|
|
||||||
func exit() -> void:
|
func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue