Exemplo n.º 1
0
        public void TingOccupyingATile()
        {
            IntPoint p = new IntPoint(5, 3);
            Ting     t = _tingRunner.GetTing("Ting0");

            t.position = new WorldCoordinate(ROOM_NAME, p);
            Room          room     = _roomRunner.GetRoom(ROOM_NAME);
            PointTileNode tileNode = room.GetTile(p);

            Ting[] occupants = tileNode.GetOccupants();
            Assert.AreEqual(1, occupants.Length);
            Assert.AreSame(t, occupants[0]);
        }
Exemplo n.º 2
0
        public void TingChangesTileToOccupy()
        {
            Ting ting = _tingRunner.GetTing("Ting0");
            Room room = _roomRunner.GetRoom(ROOM_NAME);

            IntPoint p1 = new IntPoint(2, 2);
            IntPoint p2 = new IntPoint(4, 4);

            PointTileNode tileNode1 = room.GetTile(p1);
            PointTileNode tileNode2 = room.GetTile(p2);

            Assert.AreEqual(0, tileNode1.GetOccupants().Length);
            Assert.AreEqual(0, tileNode2.GetOccupants().Length);

            ting.position = new WorldCoordinate(ROOM_NAME, p1);

            Assert.AreEqual(1, tileNode1.GetOccupants().Length);
            Assert.AreEqual(0, tileNode2.GetOccupants().Length);

            ting.position = new WorldCoordinate(ROOM_NAME, p2);

            Assert.AreEqual(0, tileNode1.GetOccupants().Length);
            Assert.AreEqual(1, tileNode2.GetOccupants().Length);
        }