|
|
|
@ -392,7 +392,7 @@ func _perform_attack(): |
|
|
|
|
|
|
|
|
|
|
|
# Fallback to default unarmed attack |
|
|
|
# Fallback to default unarmed attack |
|
|
|
# Don't attack if already attacking |
|
|
|
# Don't attack if already attacking |
|
|
|
if _body and _body.animation_player and _body.animation_player.current_animation == "Attack1": |
|
|
|
if _body and _body.animation_player and _body.animation_player.current_animation.begins_with("Attack"): |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if _attack_timer > 0: |
|
|
|
if _attack_timer > 0: |
|
|
|
@ -402,7 +402,9 @@ func _perform_attack(): |
|
|
|
|
|
|
|
|
|
|
|
# Play attack animation once |
|
|
|
# Play attack animation once |
|
|
|
if _body: |
|
|
|
if _body: |
|
|
|
_body.play_attack() |
|
|
|
_body.play_attack("Attack_OneHand") |
|
|
|
|
|
|
|
# Sync animation to other clients |
|
|
|
|
|
|
|
_sync_attack_animation.rpc("Attack_OneHand") |
|
|
|
|
|
|
|
|
|
|
|
# Find nearest enemy in range |
|
|
|
# Find nearest enemy in range |
|
|
|
var space_state = get_world_3d().direct_space_state |
|
|
|
var space_state = get_world_3d().direct_space_state |
|
|
|
@ -524,6 +526,12 @@ func _perform_dash(): |
|
|
|
|
|
|
|
|
|
|
|
# Animation is handled by the Body's animate function (Jump animation plays during dash) |
|
|
|
# Animation is handled by the Body's animate function (Jump animation plays during dash) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Sync attack animation to all clients |
|
|
|
|
|
|
|
@rpc("any_peer", "call_remote", "unreliable") |
|
|
|
|
|
|
|
func _sync_attack_animation(anim_name: String): |
|
|
|
|
|
|
|
if _body: |
|
|
|
|
|
|
|
_body.play_attack(anim_name) |
|
|
|
|
|
|
|
|
|
|
|
## Override hurt animation from BaseUnit |
|
|
|
## Override hurt animation from BaseUnit |
|
|
|
func _play_hurt_animation(): |
|
|
|
func _play_hurt_animation(): |
|
|
|
if _body and _body.animation_player: |
|
|
|
if _body and _body.animation_player: |
|
|
|
|