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);
        public static readonly AnimatorCommand CMDRun = new AnimatorCommand(AniType.Run);
        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;
        }
    }

    //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)
        {
            this.Type = type;
        }
    }
}