public void GivenTorpedo_WhenProcessTick_ThenTorpedoMoves() { SetupFakeWorld(true, false); var bot = FakeGameObjectProvider.GetBotWithActions(); bot.CurrentHeading = 90; bot.Speed = 20; bot.IsMoving = true; var torpedoPosition = VectorCalculatorService.GetPositionFrom(bot.Position, bot.Size + EngineConfigFake.Value.Torpedo.Size + 1, bot.CurrentAction.Heading); var torpedoSalvo = new TorpedoGameObject() { Id = Guid.NewGuid(), Position = torpedoPosition, Size = EngineConfigFake.Value.Torpedo.Size, Speed = EngineConfigFake.Value.Torpedo.Speed, CurrentHeading = 45, FiringPlayerId = bot.Id, IsMoving = true }; WorldStateService.AddGameObject(torpedoSalvo); tickProcessingService = new TickProcessingService( collisionHandlerResolver, VectorCalculatorService, WorldStateService, collisionService); Assert.DoesNotThrow(() => tickProcessingService.SimulateTick()); Assert.AreNotEqual(torpedoPosition, torpedoSalvo.Position); }
public new void Setup() { base.Setup(); collisionService = new CollisionService(EngineConfigFake, WorldStateService, VectorCalculatorService); collisionHandlers = new List <ICollisionHandler> { new FoodCollisionHandler(WorldStateService, EngineConfigFake), new PlayerCollisionHandler(WorldStateService, collisionService, EngineConfigFake, VectorCalculatorService) }; collisionHandlerResolver = new CollisionHandlerResolver(collisionHandlers); actionHandlers = new List <IActionHandler> { new ForwardActionHandler(), new StartAfterburnerActionHandler(WorldStateService, EngineConfigFake), new StopAfterburnerActionHandler(WorldStateService), new StopActionHandler() }; actionHandlerResolver = new ActionHandlerResolver(actionHandlers); actionService = new ActionService(WorldStateService, actionHandlerResolver); tickProcessingService = new TickProcessingService( collisionHandlerResolver, VectorCalculatorService, WorldStateService, collisionService); engineService = new EngineService(WorldStateService, actionService, EngineConfigFake, tickProcessingService); }
public new void Setup() { base.Setup(); collisionService = new CollisionService(EngineConfigFake, WorldStateService, VectorCalculatorService); collisionHandlers = new List <ICollisionHandler> { new FoodCollisionHandler(WorldStateService, EngineConfigFake), new PlayerCollisionHandler(WorldStateService, collisionService, EngineConfigFake, VectorCalculatorService) }; collisionHandlerResolver = new CollisionHandlerResolver(collisionHandlers); vectorCalculatorServiceMock = new Mock <IVectorCalculatorService>(); tickProcessingService = new TickProcessingService( collisionHandlerResolver, VectorCalculatorService, WorldStateService, collisionService); }
public void GivenBot_WhenSizeChangesDuringActionProcessing_ThenRemainingProcessStepsAreAdjusted() { SetupFakeWorld(true, false); var food = PlaceFoodAtPosition(new Position(0, 1)); var bot = FakeGameObjectProvider.GetBotWithActions(); bot.CurrentHeading = 90; bot.Speed = 20; bot.IsMoving = true; tickProcessingService = new TickProcessingService( collisionHandlerResolver, VectorCalculatorService, WorldStateService, collisionService); Assert.DoesNotThrow(() => tickProcessingService.SimulateTick()); Assert.AreEqual(11, bot.Size); Assert.AreEqual(19, bot.Speed); Assert.AreEqual(new Position(0, 19), bot.Position); }