예제 #1
0
    /// <summary>
    /// Atacando al player
    /// </summary>
    void Attack()
    {
        string tag;

        //Para que nose mueva mientrass ataca
        locomotion.moving = false;

        //Stop Attacking
        if (distanceToPlayer > cowboyAttack.attackDistance || VisionAngle(out tag) > visionAngle)
        {
            currentState = stateAI.wander;
            Debug.Log("PLayer Out of range! Stop Attaacking");

            StopCoroutine(attacking);                        
        }
    }
예제 #2
0
    /// <summary>
    /// Función llamada en el estado "patrol"
    /// 
    /// </summary>
    void Detector()
    {
        string tag;
        //Player Detected!
        //Si elplayer está en elángulo de visión
        if (VisionAngle(out tag) < visionAngle && tag == "Player")
        {
            Debug.Log("PLayer Detected! Wander");
            currentState = stateAI.wander;

            locomotion.ResetPath();
        }

        else
        {
           // Debug.Log("Did not hit");
            currentState = stateAI.patrol;
        }
    }
예제 #3
0
    /// <summary>
    /// Persiguiendo al player
    /// </summary>
    void Wander()
    {
        string tag;

        //Calculamos la ruta hasta el player e iniciamos el movimiento.
        locomotion.MoveTo(target);

        //Distancia de ataque
        if (distanceToPlayer < cowboyAttack.attackDistance && VisionAngle(out tag) < visionAngle)
        {
            Debug.Log("PLayer In range! Attaacking");

            currentState = stateAI.attack;

            //Start Attacking
            attacking = StartCoroutine(cowboyAttack.Attacking());
        }

        if (distanceToPlayer > visionRange)
        {
            currentState = stateAI.patrol;
            locomotion.MoveToRandomCover(true);
        }
    }
예제 #4
0
    //float playerH;
    //float playerMaxH;

    
    #endregion

    private void Awake()
    {
        currentState = stateAI.patrol;
    }