UnitRenderComponet.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEngine;
  2. using Mono;
  3. using System.Collections.Generic;
  4. using AniType = Mono.AnimationData.AnimationType;
  5. namespace ET.Client
  6. {
  7. [ChildOf(typeof(ModelViewComponent))]
  8. public class UnitRenderComponet : Entity, IAwake<GameObject>, IUpdate, IDestroy
  9. {
  10. public static readonly AnimatorCommand CMDIdle = new AnimatorCommand(AniType.Idle);
  11. public static readonly AnimatorCommand CMDRun = new AnimatorCommand(AniType.Run);
  12. public static readonly AnimatorCommand CMDDead = new AnimatorCommand(AniType.Dead);
  13. //指令队列
  14. public List<AnimatorCommand> Commands = new ();
  15. public GameObject GameObject { get; set; }
  16. public AnimationData AniData;
  17. public AnimatorCommand DoingCmd;
  18. //TODO: 获得模型绑定部件,如不存在返回Root
  19. public Transform GetBindPart(string partName)
  20. {
  21. return GameObject.transform;
  22. }
  23. }
  24. //TODO: 支持ObjectPool
  25. public class AnimatorCommand
  26. {
  27. public AniType Type;
  28. public float Duration = -1f;
  29. public float Speed = 1.0f;
  30. public uint GroupId = 0;
  31. public bool Loop = false;
  32. public AnimatorCommand(AniType type)
  33. {
  34. this.Type = type;
  35. }
  36. }
  37. }