示例#1
0
 public void Destroyed(Collider2D collider, GameObject Pickable, int killscore, float damage)
 {
     sr.material = WhiteMat;
     EnemyHP    -= damage;
     if (collider != null)
     {
         Destroy(collider.gameObject);
     }
     if (EnemyHP <= 0)
     {
         audioManager.Explosound();
         gameObject.GetComponent <BoxCollider2D>().enabled = false;
         sr.material = DefaultMat;
         Destroy(gameObject, 0.6f);
         score.IncreaseScore(killscore);
         if (Pickable != null)
         {
             InstantiatePickable(Pickable);
         }
     }
     else
     {
         Invoke("ResetMaterial", 0.02f);
     }
 }
示例#2
0
 public void Damaged(float damage, Collider2D collider )
 {
     sr.material = whiteMat;
     enemyHP--;
     if (collider != null)
     {
         Destroy(collider.gameObject);
     }
     if (enemyHP == 0)
     {
         audioManager.Explosound();
         sr.material = defaultMat;
         Destroyed();
     }
     else
     {
         Invoke("ResetMaterial", 0.06f);
     }
 }