Exemplo n.º 1
0
        void LoadMovementTests(LogicPart logic, DemoRules rules)
        {
            logic.Tests["Movement_Round_Forward"] = new RoundMovementTestBase(LocationTest(10,0, 0, 1, rules.Move(10)));
			logic.Tests["Movement_Round_Backward"] = new RoundMovementTestBase(LocationTest(-10, 0, 0, 1, rules.Move(-10)));
            logic.Tests["Movement_Rect_Forward"] = new RectangularMovementTestBase(LocationTest(10, 0, 0, 1, rules.Move(10)));
			logic.Tests["Movement_Rect_Backward"] = new RectangularMovementTestBase(LocationTest(-10, 0, 0, 1, rules.Move(-10)));
            logic.Tests["Movement_Rect_Square"] = new RectangularMovementTestBase(LocationTest(0, 0, 0, 50,
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi)));
			logic.Tests["Movement_Round_Square"] = new RoundMovementTestBase(LocationTest(0, 0, 0, 10,
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Rotate(Angle.HalfPi)));
			logic.Tests["Movement_Rect_Rotate"] = new RectangularMovementTestBase(LocationTest(0, 0, 90, 10, rules.Rotate(Angle.HalfPi)));
            logic.Tests["Movement_Round_Rotate"] = new RoundMovementTestBase(LocationTest(0, 0, 90, 10, rules.Rotate(Angle.HalfPi)));
          
            logic.Tests["Movement_Limit_Linear"] = new RoundMovementTestBase(LocationTest(50, 0, 0, 1,
                rules.MoveWithVelocityForTime(100000, 1)));
			logic.Tests["Movement_Limit_Round"] = new RoundMovementTestBase(LocationTest(0, 0, 0, 1,
                rules.MoveWithVelocityForTime(-100000, 1)));
            logic.Tests["Movement_Limit_Round"] = new RoundMovementTestBase(LocationTest(0, 0, 0, 1,
                rules.RotateWithVelocityForTime(Angle.Pi * 10, 4)));
            logic.Tests["Movement_Limit_Round2"] = new RoundMovementTestBase(LocationTest(0, 0, 0, 1,
                rules.RotateWithVelocityForTime(-Angle.Pi * 19 / 10, 4)));
        }
Exemplo n.º 2
0
        private void LoadCollisionTests(LogicPart logic, DemoRules rules)
        {
            logic.Tests["Collision_Rect_NoCollision"] = new RectangularCollisionTestBase(CollisionTest(0, 0, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.2)));
            logic.Tests["Collision_Rect_CollisionCount"] = new RectangularCollisionTestBase(CollisionTest(3, 3, 0,
                rules.MoveWithVelocityForTime(50, 1),
                rules.MoveWithVelocityForTime(50, 0.8),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2)));
            logic.Tests["Collision_Rect_CollisionBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(50, 1.5),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.45)));
            logic.Tests["Collision_Rect_NoBox"] = new RectangularCollisionTestBase(CollisionTest(3, 3, 0,
                rules.MoveWithVelocityForTime(50, 1.05),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.8),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2)));
            logic.Tests["Collision_Rect_RotateNoBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.MoveWithVelocityForTime(50, 1.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 1.45),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1)));
            logic.Tests["Collision_Rect_RotateBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(50, 1.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 1.6),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1)));
            logic.Tests["Collision_Rect_WallCollisionTime"] = new RectangularCollisionTestBase(ComplexCollisionTest(
                2,
                2.26,//вероятно после изменения размера робота эта велечина должна была измениться до 2,5-2,6
                false,
                false,
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Move(50)
                ));
            logic.Tests["Collision_Rect_PushingWithBrick"] = new RectangularCollisionTestBase(ComplexCollisionTest(
                2,
                8.5,
                true,
                false,
                rules.Rotate(Angle.Pi),
                rules.Move(30),
                rules.Stand(0.00001),
                rules.Grip(),
                rules.Move(-30),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Rotate(Angle.HalfPi),
                rules.Move(40),
                rules.Rotate(Angle.HalfPi)
                ));
            logic.Tests["Collision_Rect_RotateWallCollision"] = new RectangularCollisionTestBase2(ComplexCollisionTest(
                2,
                8.5, //при удалении костыля время надо тоже уменьшать на 2 сек
                false,
                false,
                rules.Rotate(Angle.Pi),
                rules.Move(30),
                rules.Stand(0.00001),
                rules.Grip(),
                rules.Rotate(-Angle.HalfPi),
                //rules.Stand(2), //костыль, чтоб тест прошел
                rules.Move(70),
                rules.Rotate(-Angle.Pi)
                ));
            logic.Tests["Collision_Rect_BrickCollision"] = new RectangularCollisionTestBase2(
                CollisionTest(
                    4,
                    true,
                    false,
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(50),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(45),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(70)
                ));
            logic.Tests["Collision_Rect_WallAndBrickCollision"] = new RectangularCollisionTestBase2(
                CollisionTest(
                    4,
                    false,
                    false,
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(15),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(45),
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(70)
                ));

        }