void Explode() { for (int x = -2; x <= 2; x++) { for (int z = -2; z <= 2; z++) { Tile tile = island.GetTileByWorldCoords(transform.position.x + x, transform.position.z + z); if (tile != null && tile.building != null) { Repairable r = tile.building.GetComponent <Repairable>(); if (r != null) { r.AddHealth(Random.Range(-60, -20)); } } } } Instantiate(evillDead, transform.position, transform.rotation); Destroy(gameObject); }
private void Repair() { target.AddHealth(Random.Range(1, 8)); }