コード例 #1
0
        public void ExecuteGameLoop_when_paused_only_calls_certain_components()
        {
            _keyboardHandler.IsNewlyPressed(Keys.Space).Returns(true);

            var actionHandler = new ActionHandler(_keyboardHandler);
            _gameEngine = new GameEngine(_universe, _gravitySimulator, _gameObjectFactory, _keyboardHandler, actionHandler, _drawingManager);

            _gameEngine.ExecuteGameLoop(new GameTime());

            _keyboardHandler.Received(1).UpdateKeyboardState();

            _gameObjectFactory.DidNotReceive().DestroyAll(Arg.Any<Predicate<IGameObject>>());
            _gravitySimulator.DidNotReceive().Simulate();
            _universe.DidNotReceive().Update();
            var temp = _gameObjectFactory.DidNotReceive().GameObjects;
            Assert.IsNull(temp);
        }
コード例 #2
0
        internal SpaceWar2Game()
        {
            _contentManager = new ContentManagerWrapper(Content.ServiceProvider, "Content");
            var graphicsDeviceManager = new GraphicsDeviceManager(this);
            _graphicsDevice = new GraphicsDeviceWrapper(graphicsDeviceManager);

            _universe = Universe.CreateDefault();
            _drawingManager = new DrawingManager(_universe);
            _gravitySimulator = new GravitySimulator();
            _shipComponentFactory = new ShipComponentFactory();
            _graphicsFactory = new GraphicsFactory();

            _gameObjectFactory = new GameObjectFactory(_contentManager, _graphicsFactory, _gravitySimulator, _drawingManager, _universe, _shipComponentFactory);

            _keyboardHandler = new KeyboardHandler(new KeyboardWrapper());

            var actionHandler = new ActionHandler(_keyboardHandler);

            _gameEngine = new GameEngine(_universe, _gravitySimulator, _gameObjectFactory, _keyboardHandler, actionHandler, _drawingManager);

            SetUpActions(actionHandler);
        }
コード例 #3
0
 public void SetUp()
 {
     _keyboardHandler = Substitute.For<IKeyboardHandler>();
     _actionHandler = new ActionHandler(_keyboardHandler);
 }