コード例 #1
0
        [Test] //Testing Collision with platform works.
        public void CollisionWithPlatformTest()
        {
            _testCollisionObstacle = new EntityContainer();
            _testCollisionPlatform = new EntityContainer();
            _testSpecifiedPlatform = new List <Dictionary <char, List <Entity> > >();
            _testPassengerList     = new List <Passenger>();

            var stationaryShape = new StationaryShape(new Vec2F(0.0f, 0.0f), new Vec2F(1.0f, 0.5f));
            var image           = new Image(Path.Combine("Assets", "Images", "Taxi_Thrust_None.png"));

            _testPlayer = new Player();
            _testPlayer.SetPosition(0.5f, 0.6f);
            _testPlayer.GetsShape().Direction.Y = -0.001f;

            _testCollisionPlatform.AddStationaryEntity(stationaryShape, image);

            CollisionChecker collisionTest = new CollisionChecker(_testCollisionObstacle, _testCollisionPlatform,
                                                                  _testPlayer, _testPassengerList, _testSpecifiedPlatform);

            while (!collisionTest.GetPlatFormChecker())
            {
                _testPlayer.PlayerMove();
                collisionTest.CheckCollsion();
            }
            Assert.AreEqual(collisionTest.GetPlatFormChecker(), true);
        }