Example #1
0
        public void Test_AddGameObject()
        {
            var model = new RoyalGameModel();
            int count = model.gameObjects.Count;
            var stone = BuilderGameObject.CreateStone(model, new PointF(30, 20));

            stone.Setup();

            model.AddOrUpdateGameObject(stone);
            Assert.AreEqual(count + 1, model.gameObjects.Count);
        }
Example #2
0
        public void TestRoomContactListener_RemoveObject()
        {
            var Room = new RoyalGameModel();

            var box = BuilderGameObject.CreateBox(Room, new PointF(55, 70));

            box.Setup();
            Room.AddOrUpdateGameObject(box);

            var player1 = BuilderGameObject.CreateGamer(Room, new PointF(50, 70));

            SolidBody solid = player1.Components.GetComponent <SolidBody>();

            Room.Field.Step(1f / 60f, 6, 3);
            solid.Parent.Model.Field.DestroyBody(solid.Body);
            Assert.AreEqual(solid.CoveredObjects.Count, 0);
        }
Example #3
0
        public void TestRoomContactListener_Remove()
        {
            var Room = new RoyalGameModel();

            var box = BuilderGameObject.CreateBox(Room, new PointF(55, 70));

            box.Setup();
            Room.AddOrUpdateGameObject(box);

            var player1 = BuilderGameObject.CreateGamer(Room, new PointF(50, 70));

            SolidBody solid = player1.Components.GetComponent <SolidBody>();

            solid.Body.SetLinearVelocity(new Vec2(0, 40f));
            Room.Field.Step(2, 6, 3);
            //только после 2 перемещения срабатывает потеря наслоения
            Room.Field.Step(1f / 60f, 6, 3);
            Assert.AreEqual(solid.CoveredObjects.Count, 0);
        }