コード例 #1
0
ファイル: Subsystems.cs プロジェクト: evankiljoy/star-trek-kg
        public Subsystems(IMap map, Ship shipConnectedTo, IStarTrekKGSettings config)
        {
            // TODO: Complete member initialization
            var game = new Game(config, false)
            {
                Map = map
            };

            var write = new Write(config);

            game.Write = write;

            this.AddRange(new List <ISubsystem>()
            {
                new Debug(shipConnectedTo, game),
                new Shields(shipConnectedTo, game)
                {
                    Energy = 0
                },
                new Computer(shipConnectedTo, game),
                new Navigation(shipConnectedTo, game),
                new ImmediateRangeScan(shipConnectedTo, game),
                new ShortRangeScan(shipConnectedTo, game),
                new LongRangeScan(shipConnectedTo, game),
                new CombinedRangeScan(shipConnectedTo, game),
                new Torpedoes(shipConnectedTo, game),
                new Phasers(shipConnectedTo, game),
                new DamageControl(shipConnectedTo, game)                     //TODO: get game ref from shipCOnnectedTo
            });
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: evankiljoy/star-trek-kg
        public Map(SetupOptions setupOptions, IOutputWrite write, IStarTrekKGSettings config, FactionName defaultHostile = null)
        {
            this.Config = config;
            this.Write  = write;

            this.DefaultHostile = defaultHostile ?? FactionName.Klingon;

            this.Initialize(setupOptions);
        }
コード例 #3
0
        /// <summary>
        /// todo: all game workflow functions go here (currently, workflow is ensconced within actors)
        /// and some unsorted crap at the moment..
        /// </summary>
        public Game(IStarTrekKGSettings config, bool startup = true)
        {
            this.RandomFactorForTesting     = 0;
            this.PlayerNowEnemyToFederation = false;  //todo: resource this out.
            this.Config = config;
            if (this.Write == null)
            {
                this.Write = new Write(config);
            }

            if (startup)
            {
                //The config file is loaded here, and persisted through the rest of the game.
                //Any settings that are not in the config at this point, will not be updated unless some fault tolerance is built in that
                //might try to reload the file. #NotInThisVersion
                this.Config.Get = this.Config.GetConfig();

                this.LatestTaunts = new List <FactionThreat>();

                //These constants need to be localized to Game:
                this.GetConstants();

                this.PrintSector =
                    (new Render(this.Write, this.Config));

                var startConfig = (new SetupOptions
                {
                    Initialize = true,
                    AddNebulae = true,
                    SectorDefs = SectorSetup()
                });

                this.Write = new Write(this.Config);
                this.Map   = new Map(startConfig, this.Write, this.Config);
                this.Write = new Write(this.Config);

                //We don't want to start game without hostiles
                if (this.HostileCheck(this.Map))
                {
                    return; //todo: unless we want to have a mode that allows it for some reason.
                }
                //Set initial color scheme
                this.Write.HighlightTextBW(false);

                //todo: why are we creating this PrintSector() class a second time??
                this.Output      = new Write(this.Map.HostilesToSetUp, Map.starbases, Map.Stardate, Map.timeRemaining, this.Config);
                this.PrintSector = new Render(this.Write, this.Config);
            }
        }
コード例 #4
0
ファイル: Region.cs プロジェクト: evankiljoy/star-trek-kg
        private Coordinate CoordinateToScan(int regionX, int regionY, IStarTrekKGSettings config)
        {
            var max = config.GetSetting <int>("RegionMax") - 1;
            var min = config.GetSetting <int>("Region_MIN");

            int divinedRegionX = regionX;
            int divinedRegionY = regionY;

            if (regionX - 1 < min)
            {
                divinedRegionX = min;
            }

            if ((regionX > max))
            {
                divinedRegionX = max;
            }

            if (regionX + 1 > max)
            {
                divinedRegionX = max;
            }

            if (regionY - 1 < min)
            {
                divinedRegionY = min;
            }

            if ((regionY > max))
            {
                divinedRegionY = max;
            }

            var RegionToScan = new Coordinate(divinedRegionX, divinedRegionY);

            return(RegionToScan);
        }
コード例 #5
0
ファイル: Render.cs プロジェクト: evankiljoy/star-trek-kg
 public Render(IOutputWrite write, IStarTrekKGSettings config)
 {
     this.Config       = config;
     this.Write        = write;
     this.Write.Config = config;
 }
コード例 #6
0
ファイル: Write.cs プロジェクト: evankiljoy/star-trek-kg
 public Write(IStarTrekKGSettings config)
 {
     this.ACTIVITY_PANEL = new List <string>();
     this.Config         = config;
 }
コード例 #7
0
ファイル: Write.cs プロジェクト: evankiljoy/star-trek-kg
        //TODO:  Have Game expose and raise an output event
        //Have UI subscribe to it.

        //Output object
        //goal is to output message that a UI can read
        //all *print* mnemonics will be changed to Output
        //UI needs to read this text and display it how it wants

        public Write(int totalHostiles, int starbases, int stardate, int timeRemaining, IStarTrekKGSettings config)
        {
            this.ACTIVITY_PANEL = new List <string>();
            this.Config         = config;
            this.TotalHostiles  = totalHostiles;
            this.Starbases      = starbases;
            this.Stardate       = stardate;
            this.TimeRemaining  = timeRemaining;
        }