Ejemplo n.º 1
0
        public ShipCreator(ShipData shipData)
        {
            _sceneShipTransform = Object.Instantiate(shipData.Ship);

            var moveTransform = new AccelerationMove(_sceneShipTransform, shipData.ShipSpeed, shipData.ShipAcceleration);
            var rotation      = new RotateShip(_sceneShipTransform);

            //_ship = new Ship(moveTransform, rotation, _sceneShipTransform);
            _ship = new Ship(new MouseMove(_sceneShipTransform, shipData.ShipSpeed),
                             new AbsenceRotation(_sceneShipTransform), _sceneShipTransform);

            _sceneBarrel = Object.Instantiate(shipData.Barrel, _sceneShipTransform);
        }
Ejemplo n.º 2
0
        public IController CreateShipFromData(ShipData data)
        {
            var spawnedShip = _providersPool.Pop();

            var shipModel = new ShipModel(
                new ShipData()
            {
                Provider     = spawnedShip,
                Speed        = data.Speed,
                Acceleration = data.Acceleration,
                HP           = data.HP,
                Force        = data.Force
            });

            var moveImplementation     = new AccelerationMove(spawnedShip.transform, shipModel.Speed, shipModel.Acceleration);
            var rotationImplementation = new RotationShip(spawnedShip.transform);

            GetShip = new Ship(moveImplementation, rotationImplementation, _weapon, shipModel);
            spawnedShip.GetComponent <IView>().ProviderDestroyed += GetShip.WatchToProviderDestroyed;

            GetShip.ReloadRequired += ReloadShipController;

            return(GetShip);
        }
Ejemplo n.º 3
0
 internal ShipModel(ShipData data)
 {
     _data = data;
 }
Ejemplo n.º 4
0
 internal ShipInitializer(ShipData data, IPool <GameObject> providersPool, IShipWeapon weapon)
 {
     _data          = data;
     _providersPool = providersPool;
     _weapon        = weapon;
 }