Esempio n. 1
0
        protected StandardZoneModel(Game game, ZoneLocation zoneLocation)
        {
            var zone = game.SittingDuck.ZonesByLocation[zoneLocation];

            ZoneLocation = zoneLocation;
            var externalThreatsInZone = game.ThreatController.ExternalThreatsOnTrack
                                        .Where(threat => threat.CurrentZone == zoneLocation)
                                        .ToList();
            var externalThreatPositions = externalThreatsInZone
                                          .Select(threat => threat.Position)
                                          .ToList();

            ExternalThreats = externalThreatsInZone
                              .Select(threat => new ExternalThreatModel(threat))
                              .ToList();
            Track  = new TrackSnapshotModel(game.ThreatController.ExternalTracks[zoneLocation], externalThreatPositions);
            Damage = zone.CurrentDamageTokens
                     .Select(damage => string.Format(CultureInfo.InvariantCulture, "{0}-{1}", zoneLocation, damage))
                     .ToList();
            TotalDamage = zone.TotalDamage;
        }
        public GameSnapshotModel(Game game, string phaseDescription)
        {
            var internalThreats        = game.ThreatController.InternalThreatsOnTrack.ToList();
            var parentThreats          = internalThreats.Where(threat => threat.Parent == null).ToList();
            var internalThreatsOnTrack = parentThreats
                                         .Concat(OrphanThreatRepresentatives(internalThreats))
                                         .ToList();
            var threatPositions = internalThreatsOnTrack.Select(threat => threat.Position).ToList();

            RedZone           = new RedZoneModel(game);
            WhiteZone         = new WhiteZoneModel(game);
            BlueZone          = new BlueZoneModel(game);
            InterceptorsZone  = new InterceptorsZoneModel(game);
            InternalThreats   = internalThreatsOnTrack.Select(threat => new InternalThreatModel(threat)).ToList();
            InternalTrack     = new TrackSnapshotModel(game.ThreatController.InternalTrack, threatPositions);
            PhaseDescription  = phaseDescription;
            TurnNumber        = game.CurrentTurn;
            KilledBy          = game.KilledBy;
            GameStatus        = game.GameStatus.GetDisplayName();
            DefeatedThreats   = game.ThreatController.DefeatedThreats.Select(threat => new ThreatModel(threat)).ToList();
            SurvivedThreats   = game.ThreatController.SurvivedThreats.Select(threat => new ThreatModel(threat)).ToList();
            KnockedOutPlayers = game.Players.Where(player => player.IsKnockedOut).Select(player => new PlayerModel(player)).ToList();
            Players           = game.Players.Select(player => new PlayerModel(player)).ToList();
        }