1
This commit is contained in:
@@ -6,7 +6,7 @@ using BITKit.Animations;
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
|
||||
public sealed class EntityAnimator : EntityComponent
|
||||
public sealed class EntityAnimator : EntityBehavior
|
||||
{
|
||||
[SerializeField] private UnityAnimator[] animators;
|
||||
[SerializeReference, SubclassSelector] private References[] animationKeyWords;
|
||||
@@ -20,7 +20,7 @@ namespace BITKit.Entities
|
||||
}
|
||||
public override void OnStart()
|
||||
{
|
||||
entity.AddListener<string>(Constant.Animation.Play, Play);
|
||||
UnityEntity.AddListener<string>(Constant.Animation.Play, Play);
|
||||
}
|
||||
|
||||
private void Play(string animationName)
|
||||
@@ -42,7 +42,7 @@ namespace BITKit.Entities
|
||||
animators.ForEach(x =>
|
||||
{
|
||||
if (x.isActiveAndEnabled)
|
||||
x.animator.SetBool(boolPar, entity.Get<bool>(boolPar));
|
||||
x.animator.SetBool(boolPar, UnityEntity.Get<bool>(boolPar));
|
||||
});
|
||||
}
|
||||
foreach (var floatPar in floatParameters)
|
||||
@@ -50,7 +50,7 @@ namespace BITKit.Entities
|
||||
animators.ForEach(x =>
|
||||
{
|
||||
if (x.isActiveAndEnabled)
|
||||
x.animator.SetFloat(floatPar, entity.Get<float>(floatPar));
|
||||
x.animator.SetFloat(floatPar, UnityEntity.Get<float>(floatPar));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -58,14 +58,14 @@ namespace BITKit.Entities
|
||||
private void OnAnimatorMove()
|
||||
{
|
||||
if (enabled is false) return;
|
||||
if (_rootVelocity is not null && entity is not null)
|
||||
entity.Set(_rootVelocity, animators[0].animator.velocity);
|
||||
if (_rootVelocity is not null && UnityEntity is not null)
|
||||
UnityEntity.Set(_rootVelocity, animators[0].animator.velocity);
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private void AnimationEvent(string eventName)
|
||||
{
|
||||
entity.Invoke(Constant.Animation.OnEvent, eventName);
|
||||
UnityEntity.Invoke(Constant.Animation.OnEvent, eventName);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user