public RaceFactory GetFactory() { RaceFactory factory = null; switch (type) { case Race.Caldari: factory = GetComponent <CaldariFactory>(); break; case Race.Amarr: factory = GetComponent <AmarrFactory>(); break; case Race.Gallente: factory = GetComponent <GallenteFactory>(); break; case Race.Minmatar: factory = GetComponent <MinmatarFactory>(); break; } return(factory); }
public void TestFact() { RaceFactory rf = RaceFactory.getRaceFactory(); Assert.IsNotNull(rf); Race jordy = rf.getRace("human"); Race willy = rf.getRace("orc"); PlayerFactory pf = PlayerFactory.getPlayerFactory(); Player p1 = pf.createPlayer(jordy, "francois", null); Assert.AreEqual(p1.name, "francois"); Player p2 = pf.createPlayer(willy, "aurelien", null); Assert.AreEqual(p2.name, "aurelien"); Assert.AreEqual(p1.race.name, jordy.name); Assert.AreEqual(p2.race.name, willy.name); History h = HistoryFactory.getHistoryFactory().createHistory(); Assert.IsNotNull(h); GameStateFactory gsf = GameStateFactory.getStateFactory(); GameState gs = gsf.createGameState(); h.set(gs); h.save(); Assert.AreEqual(h.pop(), gs); }
public static void Main() { var raceRepo = new RaceRepository(); var riderRepo = new RiderRepository(); var motorcycleRepo = new MotorcycleRepository(); var raceFactory = new RaceFactory(); var riderFactory = new RiderFactory(); var motorcycleFactory = new MotorcycleFactory(); var championshipController = new ChampionshipController( raceRepo, riderRepo, motorcycleRepo, raceFactory, riderFactory, motorcycleFactory); var consoleReader = new ConsoleReader(); var consoleWriter = new ConsoleWriter(); var engine = new Engine( championshipController, consoleReader, consoleWriter); engine.Run(); }
public static void Main(string[] args) { //TODO Add IEngine //Motorcycle varche = new PowerMotorcycle("12214235", 75); //Console.WriteLine(varche.HorsePower); IMotorcycleFactory motorcycleFactory = new MotorcycleFactory(); IRaceFactory raceFactory = new RaceFactory(); IRiderFactory riderFactory = new RiderFactory(); MotorcycleRepository motorcycleRepository = new MotorcycleRepository(); RaceRepository raceRepository = new RaceRepository(); RiderRepository riderRepository = new RiderRepository(); IChampionshipController controller = new ChampionshipController( motorcycleFactory, raceFactory, riderFactory, motorcycleRepository, raceRepository, riderRepository); IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); IEngine engine = new Engine(reader, writer, controller); engine.Run(); }
public CarManager() { this.cars = new Dictionary <int, Car>(); this.races = new Dictionary <int, Race>(); this.carFactory = new CarFactory(); this.raceFactory = new RaceFactory(); this.garage = new Garage(); }
public CarManager() { this.registeredCars = new Dictionary <int, Car>(); this.parkedCars = new Dictionary <int, Car>(); this.openRaces = new Dictionary <int, Race>(); this.carFactory = new CarFactory(); this.raceFactory = new RaceFactory(); }
public void Open(int id, string type, int length, string route, int prizePool) { Race newRace = RaceFactory.GetRace(type, length, route, prizePool); if (newRace != null) { races.Add(id, newRace); } }
public void Open(int id, string type, int length, string route, int prizePool, int timeORlaps) { Race race = RaceFactory.Produce(type, length, route, prizePool, timeORlaps); if (race != null) { races[id] = race; } }
public void Open(int id, string type, int length, string route, int prizePool, int goldTime) { var raceFactory = new RaceFactory(); var producedRace = raceFactory.CreateRace(type, length, route, prizePool, goldTime); if (producedRace != null) { this.Races.Add(id, producedRace); } }
public static void Main() { IRaceFactory raceFactory = new RaceFactory(); ICarFactory carFactory = new CarFactory(); IServiceProvider serviceProvider = ConfigureServices(); ICommandInterpreter commandInterpreter = new CommandInterpreter(serviceProvider); Engine engine = new Engine(commandInterpreter); engine.Run(); }
private void Start() { factory = GetComponent <FactoryMethod>().getFactory(); GameObject capacity = factory.makeCapacityBuilding(); GameObject building = factory.makeUnitBuilding(); capacity.GetComponent <RaceCapacity>().expand(); building.GetComponent <UnitBuilding>().produce(); }
public void Open(int id, string type, int length, string route, int prizePool, int bonus) { if (!this.Races.ContainsKey(id)) { Race newRace; newRace = RaceFactory.CreateRace(type, length, route, prizePool, bonus); this.Races.Add(id, newRace); } }
public void TownInitialize() { races = new List <RaceEntity>(); races.Add(RaceFactory.Create("Race_01", RaceType.HUMAN)); goods = new List <GoodsEntity>(); goods.Add(GoodsFactory.Create(GoodsType.FLOUR, "小麦")); var building = new SimpleProducer("農場", new ProduceAbility(goods.First(), 10), 5); townEntity = TownFactory.Create(0, "town_01", TownType.INLAND, races.First()); townEntity.Build(0, building); }
public string OpenRace(int distance, int windSpeed, int oceanCurrentSpeed, bool allowsMotorboats) { IRace race = RaceFactory.CreateRace(distance, windSpeed, oceanCurrentSpeed, allowsMotorboats); this.ValidateRaceIsEmpty(); this.CurrentRace = race; return (string.Format( "A new race with distance {0} meters, wind speed {1} m/s and ocean current speed {2} m/s has been set.", distance, windSpeed, oceanCurrentSpeed)); }
public void AddRace(IAddRaceView inForm) { RaceRepository raceRepository = RaceRepository.GetInstance(); TrackRepository trackRepository = TrackRepository.GetInstance(); if (inForm.ShowViewModal(trackRepository.GetAllActiveTracks()) == true) { try { string Name = inForm.RaceName; if (string.IsNullOrEmpty(Name)) { throw new ArgumentException("Race name is not selected!"); } DateTime Date = inForm.RaceDate; if (Date < DateTime.Today) { throw new ArgumentException("Selected date is in the past!"); } string RaceTrackName = inForm.RaceTrackName; if (string.IsNullOrEmpty(RaceTrackName)) { throw new ArgumentException("Track name is not properly selected!"); } Track RaceTrack = trackRepository.GetTrackByName(RaceTrackName); int ID = raceRepository.GetNewID(); Race newRace = RaceFactory.CreateRace(ID, Name, Date, RaceTrack); raceRepository.AddRace(newRace); } catch (TrackNotFoundException) { MessageBox.Show("Selected track not found! Try again."); } catch (RaceAlreadyExistsException) { MessageBox.Show("Race already exists! Try again."); } catch (ArgumentException ex) { MessageBox.Show(ex.Message + " Try again."); } } }
private Race MakeRace(string type, int length, string route, int prizePool, int specialRaceParameter) { Race resultRace = null; switch (type) { case "TimeLimit": resultRace = RaceFactory.MakeTimeLimitRace(length, route, prizePool, specialRaceParameter); break; case "Circuit": resultRace = RaceFactory.MakeCircuitRace(length, route, prizePool, specialRaceParameter); break; } return(resultRace); }
public RaceFactory getFactory() { RaceFactory factory = null; switch (type) { case Race.Terran: factory = GetComponent <TerranFactory>(); break; case Race.Protoss: factory = GetComponent <ProtossFactory>(); break; } return(factory); }
//• void Open(int id, string type, int length, string route, int prizePool) public void Open(int id, string type, int length, string route, int prizePool) { //open {id} {type} {length} {route} {prizePool} //OPENS a race of the given type, with the given id, and stats. //The race type will be either “Casual”, “Drag” or “Drift”. var raceFactory = new RaceFactory(); var race = raceFactory.MakeRace(type, length, route, prizePool); if (race != null) { this.races.Add(id, race); } else { throw new ArgumentException("Open: race is null"); } }
private Race MakeRace(string type, int length, string route, int prizePool) { Race resultRace = null; switch (type) { case "Casual": resultRace = RaceFactory.MakeCasualRace(length, route, prizePool); break; case "Drag": resultRace = RaceFactory.MakeDragRace(length, route, prizePool); break; case "Drift": resultRace = RaceFactory.MakeDriftRace(length, route, prizePool); break; } return(resultRace); }
private void Bonus_2_Combo_Box_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Bonus_1_Combo_Box.SelectedIndex == Bonus_2_Combo_Box.SelectedIndex) { ContextInfoTextBlock.Text = "You can't have two of the same bonuses, sorry!"; Bonus_1_Combo_Box.SelectedIndex = 0; Bonus_2_Combo_Box.SelectedIndex = 1; } foreach (Label label in BonusGrid1.Children) { label.Content = null; } if (factory != null && CharContainer.race != null) { factory = ConvertChoicesToRacialBonus(); CharContainer.race = factory.GetRace(); ModifyBonusBoxes(); } }
private void Bonus_1_Combo_Box_SelectionChanged(object sender, SelectionChangedEventArgs e) { ContextInfoTextBlock.Text = "As a half elf, you get to select your racial bonuses! Choose from one of the 5. Note that you can't stack bonuses i.e. you can't select strength twice."; if (Bonus_1_Combo_Box.SelectedIndex == Bonus_2_Combo_Box.SelectedIndex) { ContextInfoTextBlock.Text = "You can't have two of the same bonuses, sorry!"; Bonus_1_Combo_Box.SelectedIndex = 0; Bonus_2_Combo_Box.SelectedIndex = 1; } foreach (Label label in BonusGrid1.Children) { label.Content = null; } if (factory != null && CharContainer.race != null) { factory = ConvertChoicesToRacialBonus(); CharContainer.race = factory.GetRace(); ModifyBonusBoxes(); } }
public void ChangFactory() { factoryMethod.ChangeFactory(); factory = factoryMethod.GetFactory(); }
public void Move(Car self, World world, Game game, Move move) { RaceFactory.GetVehicle(self, world, game, move).Update(); }
public void Open(int id, string type, int length, string route, int prizePool, int specialParam) { this.races.Add(id, RaceFactory.CreateRace(type, length, route, prizePool, specialParam)); }
public void Open(int id, string type, int length, string route, int prizePool, string extra) { races[id] = RaceFactory.Create(type, length, route, prizePool, extra); }
private void Start() { factoryMethod = GetComponent <FactoryMethod>(); factory = factoryMethod.GetFactory(); }
public void Open(int id, string type, int length, string route, int prizePool, int extraParameter) { var race = RaceFactory.MakeRace(id, type, length, route, prizePool, extraParameter); races.Add(id, race); }
public void Open(int id, string type, int length, string route, int prize, int param) { openRaces.Add(id, RaceFactory.CreateRace(type, length, route, prize, param)); }
public void Open(int id, string type, int length, string route, int prizePool) { var race = RaceFactory.Create(type, length, route, prizePool); races[id] = race; }
public void Open(int raceId, string type, int length, string route, int pricePool, int goldTimeOrLaps = 0) { var race = RaceFactory.GenerateRace(type, length, route, pricePool, goldTimeOrLaps); races[raceId] = race; }