示例#1
0
        public void UndoIssueMovementOrders(AlienLevelOneMove move)
        {
            DeltaX = move.DeltaX;
            var alienDeltaX = move.AlienDeltaX;

            var command = move.Command;

            var shotAlienId = move.ShotAlienId;

            if (shotAlienId == 0)
            {
                foreach (var wave in Waves)
                {
                    foreach (var alien in wave)
                    {
                        alien.Command = command;
                        alien.DeltaX = alienDeltaX;
                    }
                }
            }
            else
            {
                var shotCommand = command;

                switch (command)
                {
                    case AlienCommand.MoveForward:
                        shotCommand = AlienCommand.MoveForwardAndShoot;
                        break;
                    case AlienCommand.MoveSideways:
                        shotCommand = AlienCommand.MoveSidewaysAndShoot;
                        break;
                }

                foreach (var wave in Waves)
                {
                    foreach (var alien in wave)
                    {
                        if (alien.Id == shotAlienId)
                        {
                            alien.Command = shotCommand;
                            alien.DeltaX = alienDeltaX;
                        }
                        else
                        {
                            alien.Command = command;
                            alien.DeltaX = alienDeltaX;
                        }
                    }
                }
            }
        }
示例#2
0
        private static void UndoAlienLevelOneMove(Match game, PlayerType playerType, int playerNumber, AlienLevelOneMove move)
        {
            var alienManager = game.GetPlayer(playerNumber).AlienManager;

            alienManager.UndoSpawnIfPossible();
            alienManager.RestoreDeadAliensAndWaves();

            alienManager.UndoIssueMovementOrders(move);

            if (game.GetRoundNumber() == Settings.Default.AlienWaveSizeBumpRound)
            {
                var player = game.GetPlayer(playerNumber);
                player.AlienWaveSize -= Settings.Default.AlienWaveSizeBump;
            }
            if (playerType == PlayerType.OpponentAliens)
            {
                game.DecrementRounderNumber();
            }
        }