public void NewTaskFiledWithPiece() { var piece = new GameArea.GameObjects.Piece(new Piece()); var fieldWithPiece = new GameArea.GameObjects.TaskField(new TaskField(1, 2)); fieldWithPiece.Piece = piece; Assert.IsNotNull(fieldWithPiece.Piece); }
private void CleanLocalData() { myTeam = null; otherTeam = null; SetBoard(null); Location = null; piece = null; }
public void NewTaskAddPiece() { var piece = new GameArea.GameObjects.Piece(new Piece()); var emptyField = new GameArea.GameObjects.TaskField(new TaskField(1, 2)); emptyField.Piece = piece; Assert.IsNotNull(emptyField.Piece); }
public void ProcessHandleTestPieceRequestNoPiece() { InitGameMaster(); var player = GetPlayer("testGUID-0001", 10, TeamColour.red, ActionType.TestPiece); gameMaster.RegisterPlayer(player, "testGUID-0001"); GameArea.GameObjects.Piece p = gameMaster.GetPieceById(0); TestPieceGM data = new TestPieceGM("testGUID-0001", 0); string[] msg = data.Process(gameMaster); DataGM obj = (DataGM)GMReader.GetObjectFromXML(msg[0]); Assert.AreEqual(0, obj.Pieces.Length); }
public void ProcessHandleDestroyPieceRequest() { InitGameMaster(); var player = GetPlayer("testGUID-0001", 10, TeamColour.red, ActionType.TestPiece); GameArea.GameObjects.Piece p = gameMaster.GetPieceById(0); ulong id = p.ID; var messagePieceKnown = new Piece(p.Type, p.ID) { timestamp = DateTime.Now, }; EquipPlayerWithPiece(messagePieceKnown, player); DestroyPieceGM data = new DestroyPieceGM("testGUID-0001", 0); string[] msg = data.Process(gameMaster); Assert.IsNull(gameMaster.GetPieceById(id)); }
public void ProcessPlacePieceRequestOnTaskField() { InitGameMaster(); var player = GetPlayer("testGUID-0001", 10, TeamColour.red, ActionType.TestPiece); GameArea.GameObjects.Piece p = gameMaster.GetPieceById(0); p.Type = PieceType.normal; var messagePieceKnown = new Piece(p.Type, p.ID) { timestamp = DateTime.Now, }; EquipPlayerWithPiece(messagePieceKnown, player); player.SetLocation(1, 5); gameMaster.SetAbsolutePlayerLocation(1, 5, "testGUID-0001"); PlacePieceGM data = new PlacePieceGM("testGUID-0001", 0); string[] msg = data.Process(gameMaster); Assert.AreEqual(p.ID, gameMaster.GetBoard.GetTaskField(player.Location.X, player.Location.Y).Piece.ID); }
public void ProcessHandleTestPieceRequestNormal() { InitGameMaster(); var player = GetPlayer("testGUID-0001", 10, TeamColour.red, ActionType.TestPiece); //gameMaster.RegisterPlayer(player); GameArea.GameObjects.Piece p = gameMaster.GetPieceById(0); var messagePieceKnown = new Piece(p.Type, p.ID) { timestamp = DateTime.Now, }; EquipPlayerWithPiece(messagePieceKnown, player); TestPieceGM data = new TestPieceGM("testGUID-0001", 0); string[] msg = data.Process(gameMaster); DataGM obj = (DataGM)GMReader.GetObjectFromXML(msg[0]); Assert.AreEqual(1, obj.Pieces.Length); Assert.AreEqual(p.Type, obj.Pieces[0].Type); }
public void ProcessPlacePieceRequestOnGoal() { InitGameMaster(); var player = GetPlayer("testGUID-0001", 10, TeamColour.blue, ActionType.TestPiece); ulong goalsLeft = gameMaster.GoalsBlueLeft; GameArea.GameObjects.Piece p = gameMaster.GetPieceById(0); p.Type = PieceType.normal; var messagePieceKnown = new Piece(p.Type, p.ID) { timestamp = DateTime.Now, }; EquipPlayerWithPiece(messagePieceKnown, player); player.SetLocation(1, 1); gameMaster.SetAbsolutePlayerLocation(1, 1, "testGUID-0001"); gameMaster.GetBoard.GetGoalField(1, 1).Type = GoalFieldType.goal; PlacePieceGM data = new PlacePieceGM("testGUID-0001", 0); string[] msg = data.Process(gameMaster); Assert.AreEqual(goalsLeft - 1, gameMaster.GoalsBlueLeft); }
public void SetPiece(GameArea.GameObjects.Piece piece) { this.piece = piece; }