public Controller() { warehouse = new Warehouse(this); outputView = new OutputView(warehouse); inputView = new InputView(this); TimeCounter = new TimeCounter(5000, 1000, this); }
public Game() { Points = 0; Max = 0; Switches = new List <Switch>(); Warehouses = new List <Warehouse>(); Carts = new List <Cart>(); FieldArray = new Field[12, 10]; Ship = new Ship(); GenerateFields(); LinkFields(); OutputView = new OutputView(FieldArray, this); InputView = new InputView(this); OutputView.WelcomeMessage(); GameThread = new Thread(Play); GameThread.Start(); }
public void Play() { Carts.Add(Warehouses.ElementAt(0).SpawnCart()); OutputView.StandardScreen(); while (true) { Random r = new Random(); if (Points == 0) { Max = 10; } else { double MaxDouble = (10 / Points) * 1.5; Max = (Int32)MaxDouble; } double Seconds = Max / 2; int ExtraSeconds = (Int32)Seconds; InputView.ChangeSwitch(ExtraSeconds); OutputView.StandardScreen(); foreach (var c in Carts.ToList()) { if (!c.Move()) { EndGame(); } } Ship.Move(); foreach (var w in Warehouses) { if (r.Next(Max) == Max - 1) { Carts.Add(w.SpawnCart()); } } OutputView.StandardScreen(); } }
public Controller() { GameOver = false; CurrentScore = 0; _inputView = new InputView(); _outputView = new OutputView(); _timer = new TimeController(this); _carts = new List <Cart>(); _map = new Map(); _outputView.ShowStartingScreen(); new Thread(() => { _timer.StartTimer(); }).Start(); while (!GameOver) { int key = _inputView.AskForMove(); if (GameOver) { Environment.Exit(0); } _map.ToggleSwitch(key); ShowScore(); ShowMap(); } }
// Constructor public GameController() { _inputview = new InputView(); _outputview = new OutputView(); _game = new Game(); }
private void EndGame() { OutputView.ShowEndScreen(); Console.ReadKey(); Environment.Exit(0); }