public Player(Player player) { PlayerNumber = player.PlayerNumber; PlayerNumberReal = player.PlayerNumberReal; PlayerName = player.PlayerName; Kills = player.Kills; Lives = player.Lives; RespawnTimer = player.RespawnTimer; MissileLimit = player.MissileLimit; Missiles = new List<Missile>(player.Missiles); AlienWaveSize = player.AlienWaveSize; AlienManager = new AlienManager(player.AlienManager); }
public Player(int playerNumber) { PlayerNumberReal = playerNumber; // Won't be flipped by CopyAndFlip PlayerNumber = playerNumber; PlayerName = "Player " + PlayerNumber; Kills = 0; Lives = Settings.Default.LivesInitial; RespawnTimer = 0; MissileLimit = Settings.Default.MissileLimitInitial; Missiles = new List<Missile>(); AlienWaveSize = Settings.Default.AlienWaveSizeInitial; AlienManager = new AlienManager(PlayerNumber); }
public AlienManager(AlienManager alienManager) { _debugAllMoveForward = alienManager._debugAllMoveForward; _debugAllShoot = alienManager._debugAllShoot; _debugPreventShoot = alienManager._debugPreventShoot; PlayerNumber = alienManager.PlayerNumber; Disabled = alienManager.Disabled; Waves = new List<List<Alien>>(alienManager.Waves.Count); foreach (var wave in alienManager.Waves) { Waves.Add(new List<Alien>(wave)); } ShotEnergyCost = alienManager.ShotEnergyCost; ShotEnergy = alienManager.ShotEnergy; DeltaX = alienManager.DeltaX; }
private static AlienLevelOneMove MakeAlienLevelOneMove(AlienManager alienManager) { var deltaX = alienManager.DeltaX; var waves = alienManager.Waves; if (waves.Count == 0) return new AlienLevelOneMove(AlienCommand.Nothing, deltaX); var alienDeltaX = waves[0][0].DeltaX; var shotAlienId = FindShotAlien(waves); AlienCommand command; switch (waves[0][0].Command) { case AlienCommand.MoveSideways: case AlienCommand.MoveSidewaysAndShoot: command = AlienCommand.MoveSideways; break; case AlienCommand.MoveForward: case AlienCommand.MoveForwardAndShoot: command = AlienCommand.MoveForward; break; default: command = AlienCommand.Nothing; break; } return new AlienLevelOneMove(command, deltaX, alienDeltaX, shotAlienId); }
private static Alien FindShotAlien(AlienManager alienManager, int shotAlienId) { if (shotAlienId == 0) return null; for (var i = 0; i < alienManager.Waves.Count; i++) { if (i > 1) break; foreach (var alien in alienManager.Waves[i]) { if (alien.Id == shotAlienId) { return alien; } } } return null; }
private static bool AlienKanShoot(AlienManager alienManager) { return ((alienManager.ShotEnergy + 1) >= alienManager.ShotEnergyCost) && (alienManager.Waves.Count != 0); }