예제 #1
0
        private bool ProcessAdditiveMotion(InputData data)
        {
            bool overrideAdd = CurrentAdditiveMotion == null || CurrentAdditiveMotion.IsInterruptable;

            if (!overrideAdd)
            {
                return(false);
            }
            bool          overrideBase = CurrentBaseMotion == null || CurrentBaseMotion.IsInterruptable;
            int           priority     = CurrentAdditiveMotion == null ? int.MinValue : CurrentAdditiveMotion.m_Priority;
            ActorMovement motion;

            for (int i = 0; i < mAdditiveMotions.Length; i++)
            {
                motion = mAdditiveMotions[i];
                if (motion.m_Priority < priority)
                {
                    return(false);
                }
                if (!motion.CanUseInput(data))
                {
                    continue;
                }
                if ((motion.BlendType == EMotionBlend.override_movement && overrideAdd && overrideBase) ||
                    (motion.BlendType == EMotionBlend.additive_movement && overrideAdd))
                {
                    if (CurrentAdditiveMotion != null)
                    {
                        CurrentAdditiveMotion.Interrupt();
                    }
                    if (motion.BlendType == EMotionBlend.override_movement && CurrentBaseMotion != null)
                    {
                        CurrentBaseMotion.Interrupt();
                        CurrentBaseMotion = null;
                    }
                    CurrentAdditiveMotion = motion;
                    motion.AddInput(data);
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        protected virtual void Update()
        {
            var deltaTime = Time.deltaTime;

            for (int i = 0; i < mPassiveMotions.Length; i++)
            {
                var p = mPassiveMotions[i];
                if (p.IsActive)
                {
                    p.ActorUpdate(deltaTime);
                    if (p.BlendType == EMotionBlend.override_movement)
                    {
                        //noneexecution = false;
                        if (CurrentAdditiveMotion != null)
                        {
                            CurrentAdditiveMotion.Interrupt();
                            CurrentAdditiveMotion = null;
                        }
                        if (CurrentBaseMotion != null)
                        {
                            CurrentBaseMotion.Interrupt();
                            CurrentBaseMotion = null;
                        }
                    }
                }
            }
            if (CurrentAdditiveMotion != null)
            {
                if (!isAlive)
                {
                    CurrentAdditiveMotion.Interrupt();
                    CurrentAdditiveMotion = null;
                }
                else if (CurrentAdditiveMotion.IsActive)
                {
                    CurrentAdditiveMotion.ActorUpdate(deltaTime);
                    //noneexecution = false;
                }
                else
                {
                    CurrentAdditiveMotion = null;
                }
            }
            if (CurrentBaseMotion != null)
            {
                if (!isAlive)
                {
                    CurrentBaseMotion.Interrupt();
                    CurrentBaseMotion = null;
                }
                else if (CurrentBaseMotion.IsActive)
                {
                    CurrentBaseMotion.ActorUpdate(deltaTime);
                    //noneexecution = false;
                }
                else
                {
                    CurrentBaseMotion = null;
                }
            }
        }