예제 #1
0
            public void Active(MotionMachine machine, MotionCommander commander, Command lastCommand)
            {
                //Debug.LogError(Machine.Character.name+" --active "+ Type.ToString());
                if (machine == null || commander == null)
                {
                    return;
                }
                if (Motions == null || Motions.Count == 0)
                {
                    return;
                }
                Motion motion = Motions[0];

                if (motion == null)
                {
                    return;
                }
                ActiveStatus = true;
                //motion.OnPreEndDelegate -= OnLastMotionEnd;
                motion.OnPreEndDelegate += OnLastMotionEnd;
                if (OnActiveDelegate != null)
                {
                    OnActiveDelegate(this, lastCommand);
                }
                machine.ExecuteMotion(motion.Type);
                return;
            }
예제 #2
0
 void OnGUI()
 {
     if (Animator == null)
     {
         return;
     }
     if (GUI.Button(new Rect(10, 10, 150, 30), "Idle"))
     {
         Animator.ExecuteMotion(RoleMotionType.RMT_Idle);
     }
     if (GUI.Button(new Rect(10, 50, 150, 30), " Run"))
     {
         Animator.ExecuteMotion(RoleMotionType.RMT_Run);
     }
     if (GUI.Button(new Rect(10, 90, 150, 30), "Appear"))
     {
         Animator.ExecuteMotion(RoleMotionType.RMT_Appear);
     }
 }
예제 #3
0
            private void OnLastMotionEnd(Motion motion)
            {
                if (motion != null)
                {
                    motion.OnPreEndDelegate -= OnLastMotionEnd;
                }
                Motion nextMotion = null;

                if (Machine == null || Commander == null)
                {
                    return;
                }
                if (Motions == null || Motions.Count == 0)
                {
                    return;
                }
                for (int i = 0; i < Motions.Count; i++)
                {
                    Motion tempMotion = Motions[i];
                    if (tempMotion == null)
                    {
                        continue;
                    }
                    if (tempMotion == motion)
                    {
                        if (i < Motions.Count - 1)
                        {
                            nextMotion = Motions[i + 1];
                            break;
                        }
                    }
                }
                if (nextMotion == null)
                {
                    FinishCommand(motion); return;
                }
                nextMotion.OnPreEndDelegate += OnLastMotionEnd;
                Machine.ExecuteMotion(nextMotion.Type);
            }