Ejemplo n.º 1
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "enemy" || collision.gameObject.tag == "enemybullet")
     {
         hp -= 1;
         hpstatus.UpdateHP(hp);
         DamageEffect.enabled = true;
         StartCoroutine(DisableEffect());
     }
     if (collision.gameObject.tag == "item")
     {
         GetCoin.Play();
     }
 }
Ejemplo n.º 2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         hp = 0;
     }
     if (collision.gameObject.tag == "bullet")
     {
         hp -= 1;
         hpstatus.UpdateHP(hp);
         if (hp <= 0)
         {
             score.ScoreCount();
             Vector3 Ypos = new Vector3(0f, 1.5f, 0f);
             var     uny  = GameObject.Instantiate(UNYprefab, transform.position + Ypos, Quaternion.identity);
         }
     }
 }