Example #1
0
    void Update()
    {
        if (!m_isAIActive)
        {
            return;
        }

        m_stateTimeElapsed += Time.deltaTime;
        m_currentState.UpdateState(this);
    }
Example #2
0
 void Update()
 {
     if (!aiActive)
     {
         return;
     }
     currentState.UpdateState(this);
     if (pathTimer > 0)
     {
         pathTimer -= Time.deltaTime;
     }
 }
    private void Update()
    {
        if (currentState != null)
        {
            AI_State nextState = currentState.UpdateState(this);
            if (nextState is AI_PreviousState)
            {
                nextState = previousState;
            }
            if (nextState != null)
            {
                ChangeState(nextState);
            }
            //Update Animation Speed
            velocity = navMeshAgent.velocity;

            //if (brain_rigidbody.velocity.magnitude > magnitudeMax)
            //{
            //    magnitudeMax = brain_rigidbody.velocity.magnitude;
            //}
            //Debug.Log(gameObject.name + " - RB " + brain_rigidbody.velocity.magnitude.ToString());
            //Debug.Log(gameObject.name + " - AN " + brain_animator.velocity.magnitude.ToString());
            //Debug.Log(gameObject.name + " - NM " + navMeshAgent.velocity.magnitude.ToString());

            if (velocity.magnitude > 1.6f)
            {
                brain_animator.SetFloat("Speed", 5.6f, moveSpeedDamp, Time.deltaTime);
            }
            else if (velocity.magnitude > 0.1f)
            {
                brain_animator.SetFloat("Speed", 2.0f, moveSpeedDamp, Time.deltaTime);
            }
            else
            {
                brain_animator.SetFloat("Speed", 0f, moveSpeedDamp, Time.deltaTime);
            }
        }
    }
Example #4
0
    private void Update()
    {
        DeltaT     = Time.deltaTime;
        StunTimer += Time.deltaTime;
        if (AIActive == false || _CurrentSate == null)
        {
            return;
        }
        else
        {
            _CurrentSate.UpdateState(this);
        }

        // Running animation
        if (WalkAnim == true)
        {
            AnimController.SetBool("IsWalking", true);
        }
        else
        {
            AnimController.SetBool("IsWalking", false);
        }
    }