public void Spawn() { ResetImmune(); // CHANGE FIRST SPAWN TO AFTER SO IT DOESNT EFFECT PREFABS RemovePowerup(); Instantiate(Ship, Ship.transform.position, Ship.transform.rotation); FirstSpawn(); // toggle bool that ship is not dead ShipCollide deathScript = Ship01.GetComponent <ShipCollide> (); deathScript.Toggle_Death(); }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Big_Asteroid" || other.gameObject.tag == "Medium_Asteroid" || other.gameObject.tag == "Small_Asteroid") { GameObject asteroid = other.gameObject; AsteroidCollision script = asteroid.GetComponent <AsteroidCollision>(); script.BossAsteroidCollide(); } if (other.gameObject.tag == "Shot" || other.gameObject.tag == "LongShot") { Destroy(other.gameObject); BossHealth script = gameObject.GetComponent <BossHealth> (); if (script.currentHealth != 0) { script.currentHealth -= 1; script.HandleHealth(); if (script.currentHealth <= 0) { // reset health script.currentHealth = script.maxHealth; script.HandleHealth(); AddToScore(); ExplosionSound(); RemoveBoss(); LeaveExplosion(); GameObject waveManager = GameObject.Find("WaveManager"); KeepWave waveScript = waveManager.GetComponent <KeepWave>(); waveScript.SpawnBossWave += 5; waveScript.bossSpawned = false; } } } else if (other.gameObject.tag == "Ship") { ShipCollide script = other.gameObject.GetComponent <ShipCollide>(); script.ShipCollision(); } }