예제 #1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Bullet"))
     {
         ProjectTile beam = col.gameObject.GetComponent <ProjectTile> ();
         if (beam)
         {
             health -= beam.GetDamage();                             //health berkurang
             healthBarBG.enabled = true;
             healthBar.enabled   = true;
             beam.Hit();
             healthBar.fillAmount = health / maxHealth;
         }
     }
 }
예제 #2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Bullet"))
     {
         ProjectTile beam = col.gameObject.GetComponent <ProjectTile> ();
         if (beam)
         {
             health -= beam.GetDamage();
             healthBarBG.enabled = true;
             healthBar.enabled   = true;
             beam.Hit();
             healthBar.fillAmount = health / maxHealth;
         }
     }
     if (col.name == "ObjectDestroyer")                      //jika kotak amal hancur, spawner aktif kembali
     {
         Spawner.GetComponent <SweeperSpawnerScript> ().CanSpawn = true;
     }
 }
예제 #3
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Bullet"))
     {
         ProjectTile beam = col.gameObject.GetComponent <ProjectTile> ();
         if (beam)
         {
             health -= beam.GetDamage();
             beam.Hit();
         }
     }
     if (col.CompareTag("Player"))
     {
         if (Player.getBoostStatus())
         {
             health -= health;
         }
     }
 }
예제 #4
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Bullet"))
     {
         ProjectTile beam = col.gameObject.GetComponent <ProjectTile> ();
         if (beam)
         {
             health -= beam.GetDamage();                             //darah berkurang
             healthBarBG.enabled = true;
             healthBar.enabled   = true;
             beam.Hit();
             healthBar.fillAmount = health / maxHealth;
         }
     }
     //jika menabrak player yang sedang dalam keadaan powerUp lupa
     if (col.CompareTag("Player"))
     {
         if (Player.Boost)
         {
             health -= health;                       //enemy hancur
         }
     }
 }