Exemple #1
0
 void QuemadurasSombi()
 {
     if (quemarSombi)
     {
         duracionQuemadurasSombi += Time.deltaTime;
         if (numeroQuemadurasSombi < 1)
         {
             Debug.Log("Se ha instanciado el fuego bien Sombi");
             fuegoSombiClon = Instantiate(fuegoSombi, transformSombi.transform);
             numeroQuemadurasSombi++;
         }
         if (fuegoSombiClon != null && Time.time > dañoEntreQuemadurasSombi + 2f)
         {
             vidaSombi.DañoRecibidoZombie(10);
             dañoEntreQuemadurasSombi = Time.time;
             Debug.Log("El fuego existe Sombi");
         }
         if (duracionQuemadurasSombi >= 10)
         {
             quemarSombi = false;
             Destroy(fuegoSombiClon);
             numeroQuemadurasSombi    = 0;
             duracionQuemadurasSombi  = 0;
             dañoEntreQuemadurasSombi = Time.time;
         }
     }
 }
Exemple #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Enemy") || collision.gameObject.CompareTag("Sombis"))
     {
         Debug.Log("Pere Martínez");
         ZombieLife vidaSombi = collision.GetComponentInParent <ZombieLife>();
         vidaSombi.DañoRecibidoZombie(daño);
         Destroy(this.gameObject);
     }
     if (collision.gameObject.tag == "Cuerda")
     {
         Destroy(this.gameObject);
         Destroy(cuerda);
     }
     if (collision.gameObject.CompareTag("Enemy"))
     {
         ZombieLife vidaEnemy = collision.gameObject.GetComponentInParent <ZombieLife>();
         vidaEnemy.DañoRecibidoEnemy(daño);
         Destroy(this.gameObject);
     }
 }
Exemple #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         Destroy(this.gameObject);
         LifePlayer vidaPlayer = collision.GetComponentInParent <LifePlayer>();
         vidaPlayer.VidaBaja(daño);
         //GameObject enemigoLife = GameObject.FindGameObjectWithTag("Player");
         //PlayerLife.life.health -= daño;
     }
     if (collision.gameObject.CompareTag("Sombis"))
     {
         Destroy(this.gameObject);
         ZombieLife vidaSombi = collision.GetComponentInParent <ZombieLife>();
         vidaSombi.DañoRecibidoZombie(daño);
     }
     if (collision.gameObject.tag == "Ground")
     {
         Destroy(this.gameObject);
     }
 }