Exemplo n.º 1
0
        public IGameObject CreateShip(string name, Vector2 position, Vector2 velocity, Color color, IShipController controller)
        {
            var ship = new Ship(name, position, 16, color, _graphicsFactory, _shipComponentFactory)
            {
                Velocity = velocity,
                Model = _contentManager.Load<Model>("Models/Saucer")
            };
            ship.SetController(controller);
            ship.SetShowArrows(true);

            _gravitySimulator.RegisterParticipant(ship);
            _universe.Register(ship);
            _drawingManager.Register(ship);
            _gameObjects.Add(ship);

            return ship;
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            _graphicsFactory = Substitute.For<IGraphicsFactory>();
            _graphicsDevice = Substitute.For<IGraphicsDevice>();
            _shipComponentFactory = Substitute.For<IShipComponentFactory>();

            _energyStore = Substitute.For<IEnergyStore>();
            _shield = Substitute.For<IShield>();
            _hull = Substitute.For<IHull>();
            _thrusterArray = Substitute.For<IThrusterArray>();
            _controller = Substitute.For<IShipController>();

            _shipComponentFactory.CreateEnergyStore().ReturnsForAnyArgs(_energyStore);
            _shipComponentFactory.CreateShield(Arg.Any<IShip>()).Returns(_shield);
            _shipComponentFactory.CreateHull(Arg.Any<IShip>()).Returns(_hull);
            _shipComponentFactory.CreateThrusterArray(Arg.Any<IShip>()).Returns(_thrusterArray);

            _position = new Vector2(12f, 5.5f);
            _ship = new Ship("TestShip", _position, _radius, Color.Goldenrod, _graphicsFactory, _shipComponentFactory);
            _ship.SetController(_controller);
        }