示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        public void NewTaskField()
        {
            var field = new GameArea.GameObjects.TaskField(new TaskField(1, 1));

            Assert.AreEqual(1, field.X);
            Assert.AreEqual(2, field.Y);
            Assert.IsNull(field.Piece);
        }
示例#4
0
        public void PlayerDiscoverySeesPlayerInTaskArea()
        {
            InitGameMaster();
            var Player = GetPlayer("testGUID-0004", 10, TeamColour.blue, ActionType.Discover);

            Player.SetLocation(1, 5);

            RegisterPlayer(Player, Player.GUID);

            List <GameArea.GameObjects.TaskField> list = new List <GameArea.GameObjects.TaskField>();

            for (int i = 0; i < 9; ++i)
            {
                int xIdx = i % 3;
                int yIdx = i / 3 + 4;
                if (xIdx == 1 && yIdx == 5)
                {
                    continue;
                }
                list.Add(new GameArea.GameObjects.TaskField(new TaskField((uint)xIdx, (uint)yIdx)
                {
                    timestamp       = DateTime.Now,
                    distanceToPiece = i + 1, // przykladowe dystanse - tylko dla testu czy Player sobie zapisuje u siebie
                }));
            }

            list[2] = new GameArea.GameObjects.TaskField(new TaskField((uint)0, (uint)6)
            {
                playerIdSpecified = true,
                playerId          = 3,
                timestamp         = DateTime.Now,
                distanceToPiece   = 1,
            });


            DataAgent data = new DataAgent(Player.ID)
            {
                PlayerGUID     = guid,
                GameFinished   = false,
                PlayerLocation = Player.Location,
                Tasks          = list.ToArray(),
            };

            // action: Player discovers area
            data.Process(Player.Controller);

            Assert.AreEqual(new GameArea.GameObjects.Location(1, 5), Player.Location);
            Assert.IsNotNull(Player.GetBoard.GetTaskField(0, 6).Player);
            Assert.IsNull(Player.GetBoard.GetTaskField(0, 6).Piece);
            Assert.AreEqual(1, Player.GetBoard.GetTaskField(0, 6).DistanceToPiece);
            Assert.AreEqual(3ul, Player.GetBoard.GetTaskField(0, 6).Player.ID);
        }
示例#5
0
        private GameArea.GameObjects.Field GetEmptyFieldForPlayer(TeamColour team)
        {
            int x = 0, y = team == TeamColour.blue ? (int)GetGameDefinition.GoalAreaLength : (int)GetGameDefinition.GoalAreaLength + (int)GetGameDefinition.TaskAreaLength - 1;

            GameArea.GameObjects.TaskField field = actualBoard.GetTaskField(x, y);
            while (field == null || field.Player != null)
            {
                x++;
                if (x / GetGameDefinition.BoardWidth == 1)
                {
                    x = 0;
                    y = team == TeamColour.blue ? y + 1 : y - 1;
                }
                field = actualBoard.GetTaskField(x, y);
            }
            return(field);
        }
示例#6
0
        public void TaskFieldGetType()
        {
            var field = new GameArea.GameObjects.TaskField(new TaskField(1, 1));

            Assert.AreEqual(GameArea.GameObjects.FieldType.Task, field.GetFieldType);
        }