1
This commit is contained in:
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit.Entities.Animation
|
||||
{
|
||||
public sealed class EntitiesAnimationController : EntityComponent
|
||||
public sealed class EntitiesAnimationController : EntityBehavior
|
||||
{
|
||||
[SerializeField] private UnityAnimator unityAnimator;
|
||||
[SerializeField] private SerializedDictionary<string, RuntimeAnimatorController> animatorControllers;
|
||||
@@ -20,7 +20,7 @@ namespace BITKit.Entities.Animation
|
||||
public override void OnAwake()
|
||||
{
|
||||
base.OnAwake();
|
||||
_entityEquipment.OnEquip += OnEquip;
|
||||
_entityEquipment.OnEquipAddressable += OnEquip;
|
||||
_initialRuntimeAnimatorController = unityAnimator.animator.runtimeAnimatorController;
|
||||
}
|
||||
|
||||
@@ -32,16 +32,11 @@ namespace BITKit.Entities.Animation
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEquip(IBasicItem obj)
|
||||
private void OnEquip(string equipName)
|
||||
{
|
||||
if(animatorControllers.TryGetValue(obj.AddressablePath, out var controller))
|
||||
{
|
||||
_runtimeAnimatorControllerBuffer.Release(controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeAnimatorControllerBuffer.Release(_initialRuntimeAnimatorController);
|
||||
}
|
||||
_runtimeAnimatorControllerBuffer.Release(animatorControllers.TryGetValue(equipName, out var controller)
|
||||
? controller
|
||||
: _initialRuntimeAnimatorController);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user