예제 #1
0
        private void PerformPlayerActions()
        {
            PhaseStarting(this, new PhaseEventArgs
            {
                PhaseHeader = ResolutionPhase.PerformPlayerActions.GetDescription()
            });
            foreach (var player in Players)
            {
                player.PerformStartOfPlayerActions(CurrentTurn);
            }

            var playerOrder = Players
                              .Where(player => !player.IsKnockedOut)
                              .OrderByDescending(player => player.IsPerformingMedic(CurrentTurn))
                              .ThenBy(player => player.Index);

            foreach (var player in playerOrder)
            {
                EventMaster.LogEvent(player.PlayerColor.ToString());
                while (!player.GetActionForTurn(CurrentTurn).AllActionsPerformed())
                {
                    player.CurrentStation.PerformNextPlayerAction(player, CurrentTurn);
                }
            }
            ThreatController.OnPlayerActionsEnded();
        }
예제 #2
0
        public void AddNewThreatsToTracks(int currentTurn)
        {
            PhaseStarting(this, new PhaseEventArgs {
                PhaseHeader = ResolutionPhase.AddNewThreats.GetDescription()
            });

            var newExternalThreats = ExternalThreats.Where(threat => threat.TimeAppears == currentTurn).ToList();

            foreach (var newThreat in newExternalThreats)
            {
                newThreat.AttackedSittingDuck += (sender, args) => { ThreatAttackedShip(sender, args); };
                newThreat.PlaceOnTrack(ExternalTracks[newThreat.CurrentZone]);
                EventMaster.LogEvent(string.Format(CultureInfo.CurrentCulture, "{0} Appeared", newThreat.DisplayName));
            }

            var newInternalThreats = InternalThreats.Where(threat => threat.TimeAppears == currentTurn).ToList();

            foreach (var newThreat in newInternalThreats)
            {
                newThreat.AttackedSittingDuck += (sender, args) => { ThreatAttackedShip(sender, args); };
                newThreat.PlaceOnTrack(InternalTrack);
                EventMaster.LogEvent(string.Format(CultureInfo.CurrentCulture, "{0} Appeared", newThreat.DisplayName));
            }

            if (!newExternalThreats.Any() && !newInternalThreats.Any())
            {
                EventMaster.LogEvent("No New Threats Appear.");
            }
        }