public void TestMoveLeft() { StartCell = new Cell(0, 0); _engine.Start(); _engine.MoveLeft(); Assert.AreEqual("A1", _engine.CurrentPosition); Assert.AreEqual(1, _called); }
public void Start() { // first setup game engine parameters needed before warming up ,,, engine.SetContentRoot("Content"); // ... then push starting state like engine/game splash ... TestState testState = new TestState("TestState"); GameStateManager.PushGameState(testState); // ... warm up the engine ... engine.WarmUp(); // ... then setup game engine parameters that are needed after warm up // but before complete start and also game parameters e.g when you need // GraphicsDevice for setting resolution but which is null in Core // constructor but only set on intialization by MonoGame ... engine.SetResolution(1366, 768, false); //engine.SetResolution(1920, 1080, true); // ... then start engine engine.Start(); // nothing after this can be called because it's in a loop unless it exits (handed // off to states from here on out) }
public void RunEngineShouldInitializeTheMap() { GameEngine engine = new GameEngine(Options); engine.Start(); Assert.IsTrue(engine.IsRunning); }
public void WhenPlayerRolls4_ThenTokenShouldMove4Spaces(GameEngine gameEngine, Player player, IDice dice, int diceRollResult, int positionBeforeMove) { "Given the player rolls a 4" .x(() => { dice = A.Fake <IDice>(); A.CallTo(() => dice.Roll()).Returns(4); player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); }); "When they move their token" .x(() => { positionBeforeMove = gameEngine.CurrentSquareForPlayer(player); gameEngine.MovePlayer(player, player.RollDice()); }); "Then the token should move 4 space" .x(() => { int positionAfterMove = gameEngine.CurrentSquareForPlayer(player); int result = positionAfterMove - positionBeforeMove; result.Should().Be(4); }); }
public void WhenTokenMovesToSquare100_ThenPlayerWinsGame(GameEngine gameEngine, Player player, IDice dice, int diceRollResult, int positionBeforeMove) { "Given the token is on square 97" .x(() => { player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); gameEngine.MovePlayer(player, 96); }); "When the token is moved 3 spaces" .x(() => { gameEngine.MovePlayer(player, 3); }); "Then the token is on square 100" .x(() => { gameEngine.CurrentSquareForPlayer(player).Should().Be(100); }); "And the player has won the game" .x(() => { gameEngine.Winner.Should().Be(player); }); }
public void WhenTokenMoves4StepsFrom97_ThenTokenIsOn97(GameEngine gameEngine, Player player, IDice dice, int diceRollResult, int positionBeforeMove) { "Given the token is on square 97" .x(() => { player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); gameEngine.MovePlayer(player, 96); }); "When the token is moved 4 spaces" .x(() => { gameEngine.MovePlayer(player, 4); }); "Then the token is on square 97" .x(() => { gameEngine.CurrentSquareForPlayer(player).Should().Be(97); }); "And the player has not won the game" .x(() => { gameEngine.Winner.Should().Be(null); }); }
public void AfterGameStart_WhenTokenMoves3And4Spaces_ThenTokenShouldBeOnSquare8(GameEngine gameEngine, Player player, IDice dice) { "Given the token is on square 1" .x(() => { player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); }); "When the token is moved 3 spaces" .x(() => { int spaces = 3; gameEngine.MovePlayer(player, spaces); }); "And then it is moved 4 spaces" .x(() => { int spaces = 4; gameEngine.MovePlayer(player, spaces); }); "Then the token is on square 8" .x(() => { gameEngine.CurrentSquareForPlayer(player).Should().Be(8); }); }
private void InitEngine() { _gameEngine = new GameEngine(ReDraw, ShowAlert); var engineStart = new Task(() => { _gameEngine.Start(); }); engineStart.Start(); }
public static void Main(string[] args) { GameEngine gameEngine = new GameEngine(); Face playerOne = GetFace("ertugrulungor"); Face playerTwo = GetFace("onuar"); var firstPlayer = gameEngine.Start(playerOne, playerTwo); Card pickedCard; if (playerOne.PlayerType == firstPlayer) { pickedCard = gameEngine.PickCard(playerOne); } else { pickedCard = gameEngine.PickCard(playerTwo); } var selectedPlayer = playerOne.PlayerType == firstPlayer ? playerOne : playerTwo; var mana = gameEngine.PlayToBattleGround(selectedPlayer, pickedCard); gameEngine.NextTurn(); }
public void PlayerRollsDie_ShouldBeInRangeOf1And6(GameEngine gameEngine, Player player, IDice dice, int diceRollResult) { "Given the game is started" .x(() => { dice = new Dice(); player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); }); "When the player rolls a die" .x(() => { diceRollResult = player.RollDice(); }); "Then the result should be between 1-6 inclusive" .x(() => { diceRollResult.Should().BeInRange(1, 6); }); }
private void StartEngine() { Logger.Write.BotStart("Bot now running"); EventPublisher.InformUser("Program running."); StartPauseHeader = "P_ause"; GameEngine.Start(); }
static void Main(string[] args) { var map = Map.ReadFromFile("map.txt"); var engine = new GameEngine(map); engine.Start(); }
private void StartEngine() { Log.Write("Bot now running"); AppServices.InformUser("Program running."); StartPauseHeader = "P_ause"; GameEngine.Start(); }
public void Start() { _game.Start(); BalanceBots(); _game.NewRound(); _botController.Start(); _worldBroadcastThread.Start(); _broadcastCounterThread.Start(); }
public void CreateEngineWork() { var engine = new GameEngine(6); string expected = "1 16 17 18 19 20 \r\n15 2 27 28 29 21 \r\n14 31 3 26 30 22 \r\n13 36 32 4 25 23 \r\n12 35 34 33 5 24 \r\n11 10 9 8 7 6 \r\n"; engine.Start(); Assert.AreEqual(expected, engine.BoardToString()); }
public void Should_be_able_to_start_a_game() { IRandomGenerator generator = new RandomGenerator(); IGameEngine gameEngine = new GameEngine(generator); Assert.True(gameEngine.Start()); Assert.True(gameEngine.Started); }
/// <summary> /// If the console is enabled, we load that aswell when the form is loaded /// </summary> private void TransportMayhemForm_Load(object sender, EventArgs e) { game.Start(); InputHandler.Start(canvas); if (GlobalVars.CONSOLE) { TMConsole.Start(game); } }
static void Main() { FleckLog.Level = LogLevel.Error; var renderers = new ConcurrentDictionary<IWebSocketConnection, IRenderer>(); var proxyRenderer = new ProxyRenderer(); proxyRenderer.AddRenderer( new ConsoleRenderer()); var allSockets = new List<IWebSocketConnection>(); var server = new WebSocketServer("ws://localhost:8080/websession"); server.Start(socket => { socket.OnOpen = () => { allSockets.Add(socket); renderers[socket] = new WebRenderer(socket); proxyRenderer.AddRenderer(renderers[socket]); if (allSockets.Count == 1) { var size = new Size(10, 15); var dto = new InitMessageDto(new SizeDto(size)); socket.Send(dto.ToJson()); var engine = new GameEngine(size, new ConsoleInputListener(), proxyRenderer); engine.Start(); } else { var size = new Size(10, 15); var dto = new InitMessageDto(new SizeDto(size)); socket.Send(dto.ToJson()); } }; socket.OnClose = () => { allSockets.Remove(socket); proxyRenderer.RemoveRenderer(renderers[socket]); IRenderer toRemove; renderers.TryRemove(socket, out toRemove); }; socket.OnMessage = message => { //Console.WriteLine(message); //allSockets.ToList().ForEach(s => s.Send("Echo: " + message)); }; }); while (true) { Thread.Sleep(1000); } // Console.ReadLine(); }
public void GameEngine_initialise() { //Arrange var engine = new GameEngine(gameLogic); //Act engine.Start(); //Assert Assert.IsInstanceOfType(engine, typeof(IGameEngine)); }
private void StartEngine() { LogViewModel.Write("Bot now running"); AppServices.InformUser("Program running."); var isStarted = GameEngine.Start(); if (!isStarted) { return; } StartPauseHeader = "P_ause"; }
public void ElapsedGameTimeShouldProgressAfterTick() { _gameEngine.GameTime.Elapsed.Should().Be(default(TimeSpan)); _gameEngine.Start(); _gameEngine.Tick(); var afterOneTick = _gameEngine.GameTime.Elapsed; afterOneTick.Should().BeGreaterThan(TimeSpan.FromTicks(0)); _gameEngine.Tick(); _gameEngine.GameTime.Elapsed.Should().BeGreaterThan(afterOneTick); }
public static void Run() { var ordinaryGame = new OrdinaryMazeGame(); GameEngine engine = new GameEngine(ordinaryGame); Console.WriteLine("Game's on"); engine.Start(); var magicMazeGame = new MagicMazeGame(); Console.WriteLine("SWITCHING TO MAGIC MODE"); engine.Switch(magicMazeGame); }
public void Form1_Load(object sender, EventArgs args) { i = 0; engine = new GameEngine(this); player = new SuperPlayer(); engine.SetPlayer(player); engine.AddTickMethod(SpawnerTick, TickSchedule.BEFORE_LOGIC); engine.AddTickMethod(EngineEnder, TickSchedule.AFTER_RENDER); engine.Start(); }
public static void Main() { IGameDatabase gameDatabase = new GameDatabase(); IInputReader reader = new ConsoleReader(); IOutputWriter writer = new ConsoleWriter(); var engine = new GameEngine( gameDatabase, reader, writer); engine.Start(); }
public void EnsureEngineIsNotStartetTwice() { int called = 0; RandomMock.Setup(_ => _.CalculateStart(Options.MapX, Options.MapY)) .Returns(() => { called++; return(StartCell); }); GameEngine engine = new GameEngine(Options); engine.Start().Start(); Assert.AreEqual(1, called); }
private static void TestStartGame() { var users = new List <ObjectId> { ObjectId.GenerateNewId(), ObjectId.GenerateNewId(), ObjectId.GenerateNewId() }; var gameOptions = new GameOptions(); gameOptions.AmountOfDice = 4; gameOptions.AmountOfLives = 3; gameOptions.Stair = true; game.Start(users); }
public IHttpActionResult Start([FromBody] GameDto g) { try { var userIds = g.Players.Select(userId => ObjectId.Parse(userId)); if (userIds.Count() < 1) { return(BadRequest()); } return(Ok(game.Start(userIds, g.GameOptions))); } catch (NullReferenceException e) { return(BadRequest(e.Message)); } }
public void TokenShouldBeOnSquare1(GameEngine gameEngine, Player player, IDice dice) { "Given the game is started" .x(() => { player = new Player(1, "Player 1", dice); int totalSquares = 100; gameEngine = new GameEngine(totalSquares); gameEngine.AddPlayer(player); gameEngine.Start(); }); "When the token is placed on the board" .x(() => { }); "Then the token is on square 1" .x(() => { gameEngine.CurrentSquareForPlayer(player).Should().Be(1); }); }
private void SetUpGame() { List <Module> modules = new List <Module>(); if (checkBoxHeroes.Checked) { modules.Add(HeroesExports.Module); } if (checkBoxVillains.Checked) { modules.Add(VillainsExports.Module); } if (checkBoxTestExpansion.Checked) { modules.Add(TestExports.Module); } Game = new GameEngine(int.Parse(comboBoxPlayers.SelectedItem.ToString()), modules, this); Game.Start(); }
private static void DisplayConsoleMenu() { Menu menu = new Menu(new IMenuInterface()); menu.ShowMenu(); switch (menu.Choosen) { case 0: Init(engine); engine.Start(); break; case 1: DisplayHighscores(); break; case 2: Console.SetCursorPosition(0, 32); Environment.Exit(0); break; default: break; } }
// Update is called once per frame void Update() { if (PlayerPrefs.GetInt("SaveFile") == 1) { texture.enabled = true; if (Input.GetMouseButtonDown(0) && texture.HitTest(Input.mousePosition)) { Destroy(camera2); camera.SetActive(true); player.SetActive(true); game.Start(); p.Start(); game.loadGame(); Application.LoadLevel("Village"); //GameEngine.ge.loadGame(); } } else { texture.enabled = false; } }
public static void Main() { GameEngine gameEngine = new GameEngine(); gameEngine.Start(); }