Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        // currentH = GetComponent<EnemyHealth>().currentHealth;

        // Ve al jugador?
        RaycastHit hit;

        if (controladorVision.PuedeVerAlJugador(out hit))
        {
            controladorNavMesh.perseguirObjectivo = hit.transform;
            maquinaDeEstados.ActivarEstado(maquinaDeEstados.EstadoPersecucion);
            return;
        }


        // Debug.Log(currentH);
        // Debug.Log(startingH);
        // if(startingH < currentH){
        //     currentH++;
        // }


        if (controladorNavMesh.HemosLlegado())
        {
            siguienteWayPoint = (siguienteWayPoint + 1) % WayPoints.Length;
            ActualizarWayPointDestino();
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (controladorVision.PuedeVerAlJugador(out hit))
        {
            controladorNavMesh.perseguirObjetivo = hit.transform;
            maquinaDeEstados.ActivarEstado(maquinaDeEstados.EstadoPersecucion);
            return;
        }

        if (controladorNavMesh.HemosLlegado())
        {
            siguienteWayPoint = (siguienteWayPoint + 1) % Waypoints.Length;
            ActualizarWayPointDestino();
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        //Aqui el ennemigo va a comprobar si puede ver al enemigo
        RaycastHit hit;

        if (controladorVision.PuedeVerAlJugador(out hit))
        {
            controladorNavMesh.perseguirObjectivo = hit.transform;
            maquinaDeEstados.ActivarEstado(maquinaDeEstados.EstadoPersecucion); // aqui se activa el estado persecucion
            return;
        }
        // aqui se comprueba si el jugador a llegado a su destino
        if (controladorNavMesh.HemosLlegado())
        {
            anim.Play("Caminar");
            siguienteWayPoint = (siguienteWayPoint + 1) % WayPoints.Length;
            ActualizarWayPointDestino();
            anim.Play("Caminar");
        }
    }