/// <summary> /// Fires the cannon. /// </summary> /// <returns>The shell that was fired.</returns> public override Projectile Fire() { base.Fire(); barrel.transform.localPosition = new Vector3(0f, 0f, defaultBarrelPosition - recoilDistance * Mathf.Sign(barrel.transform.localPosition.z)); Shell shell = LaunchShell(); if (turret.ship.targetedShip != null) { turret.ship.targetedShip.IncomingProjectile(shell); } if (muzzleFlashEffect != null) { muzzleFlashEffect.GetComponent <ParticleSystem>().Play(); } switch (turret.ship.length) { case 3: Soundman.PlaySoundAt(2, this.transform.position); break; case 4: Soundman.PlaySoundAt(1, this.transform.position); break; case 5: Soundman.PlaySoundAt(0, this.transform.position); break; } return(shell); }
/// <summary> /// Changes the state of the game. /// </summary> /// <param name="state">The game state to change to.</param> public static void ChangeState(GameState state) { switch (GameController.state) { } GameController.state = state; switch (state) { case GameState.TITLE: if (mainBattle) { BattleInterface.Dettach(); mainBattle.End(); } Cameraman.TakePosition("Overhead Title View"); Interface.SwitchMenu("CANCEL_OVERRIDE"); Interface.SwitchMenu("Title Screen"); Soundman.ChangeTrack(0, true, true); NewBattle(new PlayerInitializer[] { new PlayerInitializer(Color.red, true, 7), new PlayerInitializer(Color.red, true, 7) }, false); //NewBattle(new PlayerInitializer[] { new PlayerInitializer(Color.red, true), new PlayerInitializer(Color.red, true), new PlayerInitializer(Color.red, true), new PlayerInitializer(Color.red, true), new PlayerInitializer(Color.red, true) }, false); break; case GameState.BATTLING: Cameraman.TakePosition("Overhead View"); Interface.SwitchMenu("Overhead"); Soundman.ChangeTrack(2, true, true); break; case GameState.PLACING_SHIPS: Soundman.ChangeTrack(-1, true, false); break; case GameState.PLAYER_SELECTION: Soundman.ChangeTrack(1, true, false); Interface.SwitchMenu("Player Selection Screen"); PlayerSelector.Reset(); break; } }