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 }); }
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); }
/// <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); } }
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); }
public Render(IOutputWrite write, IStarTrekKGSettings config) { this.Config = config; this.Write = write; this.Write.Config = config; }
public Write(IStarTrekKGSettings config) { this.ACTIVITY_PANEL = new List <string>(); this.Config = config; }
//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; }