Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (visionControl.SeePlayer(out hit))
        {
            controladorNavMesh.followObjective = hit.transform;
            statesMachine.ActiveState(statesMachine.PatrolState);
            return;
        }

        if (controladorNavMesh.IArrived())
        {
            nextWayPoint = (nextWayPoint + 1) % WayPoints.Length;
            UpdateWayPointDestiny();
        }
    }
Beispiel #2
0
    void Update()
    {
        RaycastHit hit;

        if (visionControl.SeePlayer(out hit))
        {
            controladorNavMesh.followObjective = hit.transform;
            statesMachine.ActiveState(statesMachine.FollowState);
            return;
        }
        transform.Rotate(0f, rotateFindSpeed * Time.deltaTime, 0f);
        timeFinding += Time.deltaTime;
        if (timeFinding >= durationFinding)
        {
            statesMachine.ActiveState(statesMachine.PatrolState);
            return;
        }
    }
Beispiel #3
0
    void Update()
    {
        RaycastHit hit;

        if (!visionControl.SeePlayer(out hit, true))
        {
            stateMachine.ActiveState(stateMachine.AlertState);
            return;
        }
        controladorNavMesh.ActualizarPuntoDestinoNavMeshAgent();
    }