This commit is contained in:
CortexCore
2024-03-25 16:08:26 +08:00
parent 65d90d1bfa
commit 967ad8eacf
67 changed files with 3097 additions and 39530 deletions

View File

@@ -35,11 +35,12 @@ namespace BITKit.Entities
[SerializeField] protected AssetableItem item;
[Header(Constant.Header.Property)]
[SerializeField] public SerializedDictionary<string,AnimationProperty> animationProperties;
//[Header(Constant.Header.Property)]
//[SerializeField] public SerializedDictionary<string,AnimationProperty> animationProperties;
[Header(Constant.Header.Components)]
[SerializeField] private AnimancerComponent animancerComponent;
[SerializeField] private AnimancerComponent additionalAnimancerComponent;
[SerializeField] protected EntityVFXPlayer vfxPlayer;
[SerializeField] private Renderer[] renderers;
[SerializeField] protected Transform cameraTransform;
@@ -52,6 +53,7 @@ namespace BITKit.Entities
public IEntity Entity { get; set; }
public Entity UnityEntity=>Entity as Entity;
public AnimancerComponent AnimancerComponent=>animancerComponent;
public AnimancerComponent AdditionalAnimancerComponent=>additionalAnimancerComponent;
public IMotionMatchingService MotionMatchingService=>motionMatchingService;
public IBasicItem Item
@@ -64,7 +66,7 @@ namespace BITKit.Entities
}
}
private IBasicItem _item;
public IDictionary<string, float> AnimationProperties = null;
//public IDictionary<string, float> AnimationProperties = null;
[Inject(true),NonSerialized]
public InputActionGroup inputActionGroup;
@@ -89,7 +91,15 @@ namespace BITKit.Entities
public virtual void Entry()
{
if (animancerComponent)
{
animancerComponent.enabled = true;
animancerComponent.Animator.enabled = true;
}
if (additionalAnimancerComponent)
{
additionalAnimancerComponent.enabled = true;
additionalAnimancerComponent.Animator.enabled = true;
}
AllowRendering.AddElement(this);
//inputActionGroup.allowInput.AddElement(this);
@@ -116,10 +126,6 @@ namespace BITKit.Entities
public virtual UniTask ExitAsync()
{
AllowRendering.RemoveElement(this);
if (animancerComponent)
animancerComponent.Animator.enabled = false;
return UniTask.CompletedTask;
}
@@ -130,13 +136,28 @@ namespace BITKit.Entities
await UniTask.NextFrame(destroyCancellationToken);
cameraTransform.localPosition = default;
cameraTransform.localRotation = _initialCameraRotation;
if (animancerComponent)
{
animancerComponent.enabled = false;
animancerComponent.Animator.enabled = false;
}
if(AdditionalAnimancerComponent)
{
AdditionalAnimancerComponent.enabled = false;
AdditionalAnimancerComponent.Stop();
AdditionalAnimancerComponent.Animator.enabled = false;
}
}
public virtual void OnAwake()
{
AnimationProperties= animationProperties.ToDictionary(x=>x.Key,x=>x.Value.Value);
//AnimationProperties= animationProperties.ToDictionary(x=>x.Key,x=>x.Value.Value);
if (renderers is null or { Length: 0 })
{
renderers = GetComponentsInChildren<Renderer>(true);
}
foreach (var x in StateDictionary.Values)
{
@@ -195,10 +216,10 @@ namespace BITKit.Entities
public virtual void OnUpdate(float deltaTime)
{
foreach (var pair in animationProperties)
{
AnimationProperties[pair.Key] = pair.Value.Value;
}
// foreach (var pair in animationProperties)
// {
// AnimationProperties[pair.Key] = pair.Value.Value;
// }
}
public virtual bool IsSupportItem(IBasicItem item) =>item is not null && item.AddressablePath == AddressablePath;