public void TestInitialize() { _gameController = Substitute.For <IGameController>(); _logicHandler = Substitute.For <ILogicHandler>(); _gameEngineInterface = Substitute.For <IGameEngineInterface>(); _dataLayer = Substitute.For <IDataLayer>(); _audioSourceShip = Substitute.For <IAudioSource>(); _playerShip = Substitute.For <IGameObject>(); _playerShip.Transform = Substitute.For <ITransform>(); _camera = Substitute.For <IGameObject>(); _gameEngineInterface.FindGameObject("MainCamera").Returns(_camera); _camera.Transform.Position.Returns(new Vector3(0, 0, 0)); _sourceAsteroid = Substitute.For <IGameObject>(); _gameEngineInterface.FindGameObject("sourceAsteroid").Returns(_sourceAsteroid); _sourceAsteroid.Transform.Position.Returns(new Vector3(0, 0, 0)); _playerShipScript = Substitute.For <IPlayerShipScript>(); _playerShipScript.Health.Returns(100); _playerShip.GetSize().Returns(new Vector3(10, 10, 10)); _gameEngineInterface.Screen.Width.Returns(SCREEN_WIDTH); _logicHandler.GameController = _gameController; _asteroidPlacementLogicImplementer = Substitute.For <IAsteroidPlacementLogicImplementer>(); _gameLogicProvider = new GameLogicProvider(_logicHandler, _gameEngineInterface, _dataLayer, _asteroidPlacementLogicImplementer); //todo 2nd game: couldn't get Substitute.ForPartsOf to work, so I had to mock all the stuff needed for the call to InitStage() _gameEngineInterface.Time = Substitute.For <ITime>(); _gameEngineInterface.Time.DeltaTime.Returns(1); }
public GameLogicProvider(ILogicHandler gameLogicHandler, IGameEngineInterface gameEngineInterface, IDataLayer dataLayer, IAsteroidPlacementLogicImplementer asteroidPlacementLogicImplementer) : base(gameLogicHandler, gameEngineInterface, dataLayer) { _halfScreenWidth = _gameEngineInterface.Screen.Width / 2; _inputStates[InputAxis.Horizontal] = 0f; _inputStates[InputAxis.Cancel] = 0f; _gameEngineInterface.TimeScale = 1; _asteroidPlacementLogicImplementer = asteroidPlacementLogicImplementer; }