Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        // Comprueba si ve al jugador
        RaycastHit hit;

        if (visionController.canSeePlayer(out hit))
        {
            navMeshController.pursuitEnemy = hit.transform;

            stateMachine.ActivateState(stateMachine.PursuitState);
            return;
        }
        if (navMeshController.Arrive())
        {
            nextWayPoint = (nextWayPoint + 1) % WayPoints.Length;
            UpdateDestinyWayPoint();
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (visionController.canSeePlayer(out hit))
        {
            navMeshController.pursuitEnemy = hit.transform;

            stateMachine.ActivateState(stateMachine.PursuitState);
            return;
        }

        transform.Rotate(0f, searchRotationVelocity * Time.deltaTime, 0f);
        searchingTime += Time.deltaTime;
        if (searchingTime > searchTime)
        {
            stateMachine.ActivateState(stateMachine.PatrolState);
            return;
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (!visionController.canSeePlayer(out hit, true))
        {
            stateMachine.ActivateState(stateMachine.AlertState);

            return;
        }

        navMeshController.UpdateDestinyPointNavMeshAgent();
    }