public void OnAwake(MotionMachine machine, MotionCommander commander)
 {
     Machine   = machine;
     Commander = commander;
     if (machine != null)
     {
         if (machine.Motions != null && machine.Motions.Count > 0 && SequentialMotions != null && SequentialMotions.Count > 0)
         {
             for (int i = 0; i < SequentialMotions.Count; i++)
             {
                 RoleMotionType motionType = SequentialMotions[i];
                 Motion         motion     = machine.GetMotion(motionType);
                 if (motion == null)
                 {
                     continue;
                 }
                 if (Motions == null)
                 {
                     Motions = new List <Motion>();
                 }
                 Motions.Add(motion);
             }
         }
     }
 }
示例#2
0
        public bool IsMotionNameLegal(RoleMotionType type)
        {
            if (Instance == null)
            {
                return(false);
            }
            Motion motion = Instance.GetMotion(type);

            if (motion == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void PlayIdle()
        {
            if (Machine == null)
            {
                return;
            }
            Motion idleMotion = Machine.GetMotion(RoleMotionType.RMT_Idle);

            if (idleMotion == null)
            {
                return;
            }
            if (Machine.Animation != null)
            {
                Machine.Animation.Play(idleMotion.ClipName);
            }
        }