Esempio n. 1
0
        private void ChangeMovementState(float speed, string animName, bool animValue, ET.AIMovementState newState)
        {
            m_Agent.speed = speed;

            m_Brain.Settings.Animation.ToggleBool(animName, animValue);

            m_MovementState = newState;
        }
Esempio n. 2
0
        /// <summary>
        /// Help function called from some actions that allows to check if the AI has already arrived it's current target point(m_CurrentDestination).
        /// </summary>
        /// <returns></returns>
        public bool ReachedDestination(bool isStop = true)
        {
            if (m_Agent.remainingDistance <= m_Agent.stoppingDistance)
            {
                if (isStop)
                {
                    //Find out which animation we have to toggle off.
                    string toggleOffAnim = (m_MovementState == ET.AIMovementState.Running) ? HelpStrings.AI.ANIMATOR_PARAM_RUN : HelpStrings.AI.ANIMATOR_PARAM_WALK;

                    m_Brain.Settings.Animation.ToggleBool(toggleOffAnim, false);

                    m_MovementState = ET.AIMovementState.Idle;
                }

                return(true);
            }

            return(false);
        }