示例#1
0
        void Update()
        {
            if (target == null)
            {
                return;
            }

            // If the enemy and the player have health left...
            if (enemyHealth.currentHealth > 0)
            {
                if (Vector3.Distance(transform.position, target.position) <= damageRange)
                {
                    clock += Time.deltaTime;

                    if (clock > damageCadency)
                    {
                        clock = 0;
                        targetHealth.TakeDamage(-damage);
                    }
                }
                else
                {
                    nav.SetDestination(target.position);
                }
            }
            else
            {
                return;
            }
        }
示例#2
0
    IEnumerator SacarAlJugadorTrampa()
    {
        yield return(new WaitForSeconds(tiempo));

        interfazBotones.SetActive(false);
        QuitarVida.TakeDamage(cantidadVidaAQuitar);
        SacarJugador();
    }