[Test] // Testing too much speed collision with platform results in death. public void CollisionWithPlatformDeathTest() { _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.005f; _testCollisionPlatform.AddStationaryEntity(stationaryShape, image); CollisionChecker collisionTest = new CollisionChecker(_testCollisionObstacle, _testCollisionPlatform, _testPlayer, _testPassengerList, _testSpecifiedPlatform); while (!collisionTest.GetGameOverChecker()) { _testPlayer.PlayerMove(); collisionTest.CheckCollsion(); } Assert.AreEqual(collisionTest.GetGameOverChecker(), true); }
public void CollisionWithPassenger() { _testCollisionObstacle = new EntityContainer(); _testCollisionPlatform = new EntityContainer(); _testSpecifiedPlatform = new List <Dictionary <char, List <Entity> > >(); _testPassengerList = new List <Passenger>(); Level.SetLegendsDictionaryToNew(); Level.SetDiffrentPlatformsToNew(); Level.SetPlatformLegendsToNew(); _levelinfo = Level.ReadFile(_filePath[1]); Level.ReadPlatforms(_levelinfo[25]); Level.ReadLegends(_levelinfo); for (int j = 0; j < 23; j++) { for (int c = 0; c < Level.GetPlatformLegends().Count; c++) { for (int i = 0; i < _levelinfo[0].Length; i++) { Level.SpecifyPlatforms(_levelinfo, Level.GetLegendsDictionary(), j, i, c); } } } _testSpecifiedPlatform.Add(Level.GetDiffrenPlatforms()); Level.SetLegendsDictionaryToNew(); Level.SetDiffrentPlatformsToNew(); Level.SetPlatformLegendsToNew(); _levelinfo = Level.ReadFile(_filePath[1]); Level.ReadPlatforms(_levelinfo[25]); Level.ReadLegends(_levelinfo); for (int j = 0; j < 23; j++) { for (int c = 0; c < Level.GetPlatformLegends().Count; c++) { for (int i = 0; i < _levelinfo[0].Length; i++) { Level.SpecifyPlatforms(_levelinfo, Level.GetLegendsDictionary(), j, i, c); } } } _testSpecifiedPlatform.Add(Level.GetDiffrenPlatforms()); _testPlayer = new Player(); _testPlayer.SetPosition(0.1f, 0.6f); _testPlayer.GetsShape().Direction.X = 0.005f; _testPlayer.GetsShape().Direction.Y = 0.0000001f; _testPassenger = new Passenger("Bob", 0, '1', "^", 10, 100, _testSpecifiedPlatform, 0); _testPassenger.GetShape().Direction.X = 0.0f; _testPassenger.SetPosition(0.9f, 0.0f); _testPassenger.SetExtent(0.1f, 1.0f); _testPassenger.StartSpawnTimer(); _testPassengerList.Add(_testPassenger); CollisionChecker collisionTest = new CollisionChecker(_testCollisionObstacle, _testCollisionPlatform, _testPlayer, _testPassengerList, _testSpecifiedPlatform); while (!_testPassengerList[0].PickedUp) { _testPlayer.PlayerMove(); collisionTest.CheckCollsion(); } Assert.AreEqual(_testPassengerList[0].PickedUp, true); }