Beispiel #1
0
    public override void UpdateState()
    {
        var   playerPos = m_BikerAI.m_Player.transform.position;
        float fRange    = Vector3.Magnitude(playerPos - transform.position);

        // IF within attack range
        if (fRange < m_BikerAI.m_fAttackRange)
        {
            if (Vector3.Angle(transform.forward, playerPos - transform.position) < m_BikerAI.m_fMaxAttackAngle)
            {
                m_BikerAI.ChangeState("BikerAttackState");
                return;
            }
        }

        // IF beyond chase range
        else if (fRange > m_BikerAI.m_fChaseRange)
        {
            m_BikerAI.ChangeState("BikerCatchupState");
            return;
        }

        m_Movement.GetPathToPlayer();
        m_Movement.MoveChase();
    }
    public override void UpdateState()
    {
        float fRange = Vector3.Magnitude(m_BikerAI.m_Player.transform.position - m_ParentObject.transform.position);

        // IF in range of player
        if (fRange < m_BikerAI.m_fChaseRange)
        {
            m_BikerAI.ChangeState("BikerChaseState");
            return;
        }

        m_Movement.GetPathToPlayer();
        m_Movement.MoveChase();
    }