private void Awake() { if (instance != null) { Destroy(this); } instance = this; }
public void death() { EnnemyGenerator gen = GameObject.Find("EnnemyGenerator").GetComponent <EnnemyGenerator> (); if (gen.maxEnnemy == gen.getNumEnnemy()) { gen.timeLastEnnemy = Time.time; } Destroy(this.gameObject); }