1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using UnityEngine;
- using Mono;
- using System.Collections.Generic;
- using AniType = Mono.AnimationData.AnimationType;
- namespace ET.Client
- {
- [ChildOf(typeof(ModelViewComponent))]
- public class UnitRenderComponet : Entity, IAwake<GameObject>, IUpdate, IDestroy
- {
- public static readonly AnimatorCommand CMDIdle = new AnimatorCommand(AniType.Idle, true);
- public static readonly AnimatorCommand CMDRun = new AnimatorCommand(AniType.Run, true);
- public static readonly AnimatorCommand CMDDead = new AnimatorCommand(AniType.Dead);
- //指令队列
- public List<AnimatorCommand> Commands = new ();
- public GameObject GameObject { get; set; }
- public AnimationData AniData;
- public AnimatorCommand DoingCmd;
- //TODO: 获得模型绑定部件,如不存在返回Root
- public Transform GetBindPart(string partName)
- {
- return GameObject.transform;
- }
- public void Reset()
- {
- GameObject = null;
- AniData = null;
- DoingCmd = null;
- }
- }
- //TODO: 支持ObjectPool
- public class AnimatorCommand
- {
- public AniType Type;
- public float Duration = -1f;
- public float Speed = 1.0f;
- public uint GroupId = 0;
- public bool Loop = false;
- public AnimatorCommand(AniType type, bool loop = false)
- {
- this.Type = type;
- this.Loop = loop;
- }
- public bool IsSkillCmd()
- {
- return Type >= AniType.Skill0 && Type < AniType.SkillMax;
- }
- }
- }
|