// Explodes losing team's Rocket base and shakes the screen private IEnumerator MichaelBay(Vector3 corePos) { Vector3 rocketPosL = new Vector3(corePos.x - 1, corePos.y - 1, corePos.z); Vector3 rocketPosR = new Vector3(corePos.x + 1, corePos.y - 1, corePos.z); GameObject boom0 = Instantiate(explosion, corePos, Quaternion.identity); boom0.GetComponent <LoopingAnimation>().StartAnimation(); SFXManager.GetSFXManager().PlaySFX(SFX.LargeExplosion); CameraShake.Shake(0.5f, 0.4f, true); yield return(new WaitForSeconds(0.2f)); GameObject boom1 = Instantiate(explosion, rocketPosL, Quaternion.identity); boom1.GetComponent <LoopingAnimation>().StartAnimation(); SFXManager.GetSFXManager().PlaySFX(SFX.LargeExplosion); CameraShake.Shake(0.5f, 0.4f, true); yield return(new WaitForSeconds(0.2f)); GameObject boom2 = Instantiate(explosion, rocketPosR, Quaternion.identity); boom2.GetComponent <LoopingAnimation>().StartAnimation(); SFXManager.GetSFXManager().PlaySFX(SFX.LargeExplosion); CameraShake.Shake(0.5f, 0.4f, true); SlowMo.End(); }
// Initialization void Start() { slowMo = transform.root.GetComponentInChildren <SlowMo> (); rapidFire = transform.root.GetComponentInChildren <RapidFire> (); turretMode = transform.root.GetComponentInChildren <TurretMode> (); // Assign other ability references here // Testing: //UnlockSlowMo(1); //UnlockRapidFire(1); //UnlockTurretMode(1); //UnlockStarMode(1); }
// Resume the game. If resetTimeScale, Time.timeScale is set back to 1 public void resume(bool resetTimeScale = true) { paused = false; if (resetTimeScale) { SlowMo.resetTimeScale(); previousTimeScale = 1; } else { Time.timeScale = previousTimeScale; } HUD.SetActive(true); PauseMenu.SetActive(false); OptionsMenu.SetActive(false); }
// Sets gameOver to true and creates an explosion at the losing team's core public void EndGame(Block destroyedCoreBlock) { Destroy(TopBattleWall); ExecuteOverPlayers(new player_delegate(DisableIndicators)); int winner = (destroyedCoreBlock.teamNum == 1) ? 2 : 1; float slow_mo_speed = 0.2f; SlowMo.Begin(slow_mo_speed, destroyedCoreBlock.transform.position); StartCoroutine(MichaelBay(destroyedCoreBlock.transform.position)); gameOver = true; if (!in_tutorial) { TimerDisplay.SetActive(true); } ui_phase.text = "Team " + winner; ui_timeLeft.text = "Wins"; // SK: Winning ship flies up off the screen cores [winner - 1].GetComponent <Controllable> ().SetGameOver(); Invoke("BackToMenu", 5); }
private void Awake() { main = this; }
void Awake() { instance = this; }