Work SFX work
Fix up Eden Pillar behavior
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -25,10 +26,12 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
|
||||
[Node] public AnimationTree AnimationTree { get; set; } = default!;
|
||||
|
||||
[Export] public AttackDataResource AttackData { get; set; }
|
||||
[Node] private AudioStreamPlayer3D _walkSFX { get; set; } = default!;
|
||||
|
||||
protected AnimationNodeStateMachinePlayback _stateMachine;
|
||||
|
||||
public AttackData AttackData { get; set; }
|
||||
|
||||
public event EventHandler HitPlayer;
|
||||
|
||||
public event EventHandler ActivationFinished;
|
||||
@@ -40,23 +43,55 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
if (AnimationTree != null)
|
||||
{
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PlayPrimaryAttackAnimation() => _stateMachine.Travel(_primaryAttackName, false);
|
||||
public virtual void PlayPrimaryAttackAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_primaryAttackName, false);
|
||||
}
|
||||
|
||||
public virtual void PlaySecondaryAttackAnimation() => _stateMachine.Travel(_secondaryAttackName, false);
|
||||
public virtual void PlaySecondaryAttackAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_secondaryAttackName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayPrimarySkillAnimation() => _stateMachine.Travel(_primarySkillName, false);
|
||||
public virtual void PlayPrimarySkillAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_primarySkillName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayIdleAnimation() => _stateMachine.Travel(_idleName, false);
|
||||
public virtual void PlayIdleAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_idleName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayWalkAnimation() => _stateMachine.Travel(_walkingName, false);
|
||||
public virtual void PlayWalkAnimation()
|
||||
{
|
||||
if (!_walkSFX.Playing)
|
||||
_walkSFX.Play();
|
||||
_stateMachine.Travel(_walkingName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayStopWalkAnimation() => _stateMachine.Travel(_stopWalkName, false);
|
||||
public virtual void PlayStopWalkAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_stopWalkName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayActivateAnimation() => _stateMachine.Travel(_activateName, false);
|
||||
public virtual void PlayActivateAnimation()
|
||||
{
|
||||
_walkSFX.Stop();
|
||||
_stateMachine.Travel(_activateName, false);
|
||||
}
|
||||
|
||||
public virtual void PlayDeathAnimation() => throw new System.NotImplementedException();
|
||||
|
||||
@@ -75,6 +110,7 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();
|
||||
if (AnimationTree != null)
|
||||
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user