Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
31
weapons/knife/knife_attack.gd
Normal file
31
weapons/knife/knife_attack.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var damage: int
|
||||
var end_it: bool = true
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||
attack()
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
|
||||
func exit() -> void:
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
end_it = false
|
||||
|
||||
func attack() -> void:
|
||||
if is_multiplayer_authority():
|
||||
Session.shoot(int(machine.player.name),damage,1.5)
|
||||
|
||||
func on_animation_finished(animation):
|
||||
if animation == machine.animation_prefix + "attack":
|
||||
if end_it:
|
||||
transition.emit("Idle")
|
||||
else:
|
||||
attack()
|
||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||
|
||||
func use_begin() -> void:
|
||||
end_it = false
|
||||
|
||||
func use_end() -> void:
|
||||
end_it = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue