Beispiel #1
0
    void Update()
    {
        RaycastHit hit;

        if (vision.PuedeVerAlJugador(out hit))
        {
            agente.perseguirOjetivo = hit.transform;
            estados.ActivarEstado(estados.Perseguir);
            return;
        }
        if (agente.Llego())
        {
            sigpunto = (sigpunto + 1) % WayPoints.Length;
            Actualizarwaypoint();
        }
    }
Beispiel #2
0
    void Update()
    {
        RaycastHit hit;

        if (vision.PuedeVerAlJugador(out hit))
        {
            agente.perseguirOjetivo = hit.transform;
            estados.ActivarEstado(estados.Perseguir);
            return;
        }
        transform.Rotate(0f, velocidadGiroBusqueda * Time.deltaTime, 0f);
        tiempoBuscando += Time.deltaTime;
        if (tiempoBuscando >= duracionBusqueda)
        {
            estados.ActivarEstado(estados.Patrulla);
            return;
        }
    }
Beispiel #3
0
    void Update()
    {
        RaycastHit hit;

        if (!vision.PuedeVerAlJugador(out hit, true))
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                timer = 0;
                estados.ActivarEstado(estados.Patrulla);
                return;
            }
        }
        agente.ActualizarPuntoN();
    }