void PowerUpsCollisionDetection(Collider2D collision) { switch (collision.gameObject.tag) { case "Ammunition": shipAttackController.AddAmmo(1); //soundController.playSFX("ammoPickup"); Destroy(collision.gameObject.transform.parent.gameObject); break; case "ShieldPowerUp": if (shipHealthManager.GetShipShield() == 5) { scoreController.AddScore(50); } shipHealthManager.AddShield(1); hudController.UpdateShieldHUD(shipHealthManager.GetShipShield()); soundController.playSFX("shieldPowerUpPickup"); Destroy(collision.gameObject); break; case "NukePowerUp": if (shipAttackController.GetAmountOfNukes() == 5) { scoreController.AddScore(100); } shipAttackController.AddNuke(); hudController.UpdateNukesHUD(shipAttackController.GetAmountOfNukes()); soundController.playSFX("nukePowerUpPickup"); Destroy(collision.gameObject); break; case "TripleBulletPowerUp": if (shipAttackController.GetTypeOfFiringSystem() == "tripleBullet") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.shipHasSpecialBullet = false; } if (shipAttackController.GetTypeOfFiringSystem() == "laserStream") { shipAttackController.DeactivateLaserMode(); StopCoroutine(this.currentFiringTypeRoutine); //Find a way of optmize this mess shipAttackController.ResetFiringSystem(); shipAttackController.SetFirePermission(true); } if (shipAttackController.GetTypeOfFiringSystem() == "purpleBomb") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.shipHasSpecialBullet = false; shipAttackController.ResetFiringSystem(); } this.currentFiringTypeRoutine = StartCoroutine(shipAttackController.ActivateTripleBulletFiringSystem("tripleBullet")); soundController.playSFX("tripleBulletPowerUpPickup"); Destroy(collision.gameObject); break; case "PurpleBombPowerUp": if (shipAttackController.GetTypeOfFiringSystem() == "purpleBomb") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.ResetFiringSystem(); } if (shipAttackController.GetTypeOfFiringSystem() == "tripleBullet") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.ResetFiringSystem(); } if (shipAttackController.GetTypeOfFiringSystem() == "laserStream") { shipAttackController.DeactivateLaserMode(); StopCoroutine(this.currentFiringTypeRoutine); //Find a way of optmize this mess shipAttackController.ResetFiringSystem(); shipAttackController.SetFirePermission(true); } this.currentFiringTypeRoutine = StartCoroutine(shipAttackController.ActivatePurpleBombFiringSystem("purpleBomb")); soundController.playSFX("tripleBulletPowerUpPickup"); Destroy(collision.gameObject); break; case "LaserPowerUp": if (shipAttackController.GetTypeOfFiringSystem() == "laserStream") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.shipHasSpecialBullet = false; } if (shipAttackController.GetTypeOfFiringSystem() == "tripleBullet") { StopCoroutine(this.currentFiringTypeRoutine); //Find a way of optmize this mess shipAttackController.ResetFiringSystem(); shipAttackController.SetFirePermission(true); } if (shipAttackController.GetTypeOfFiringSystem() == "purpleBomb") { StopCoroutine(this.currentFiringTypeRoutine); //Works but maybe not the optimal way shipAttackController.ResetFiringSystem(); shipAttackController.SetFirePermission(true); } this.currentFiringTypeRoutine = StartCoroutine(shipAttackController.ActivateLaserMode()); soundController.playSFX("laserPowerUpPickup"); Destroy(collision.gameObject); break; case "ShipBerserkerPowerUp": if (shipAttackController.HasBerserkerMode() == true) { shipAttackController.DeactivateBerserkerMode(); StopCoroutine(this.currentBerserkerRoutine); //Works but maybe not the optimal way } this.currentBerserkerRoutine = StartCoroutine(shipAttackController.ActivateBerserkerMode()); soundController.playSFX("berserkerPowerUpPickup"); Destroy(collision.gameObject); break; } }