public void DecreaseHealthBy(float healthDecrement) { this.health -= healthDecrement; if (this.health <= 0) { // if it's a defender I need to free its position from the grid to be able to spawn again in that position if (this.GetComponent <Defenders>()) { defenderSpawner.FreePos(this.transform.position); } DestroyObject(); } }