Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public IPlayerContorllable ReloadShip(IMove moveImplementation, IRotation rotationImplemetation, ShipModel model)
 {
     _model                  = model;
     _moveImpementation      = moveImplementation;
     _rotationImplementation = rotationImplemetation;
     return(this);
 }
Exemplo n.º 3
0
 internal Ship(IMove moveImplementation, IRotation rotationImplemetation, IShipWeapon weapon, ShipModel model)
 {
     _model                  = model;
     _moveImpementation      = moveImplementation;
     _rotationImplementation = rotationImplemetation;
     _weapon                 = weapon;
     _weapon.EquipWeapon(_model.BarrelPosition);
     _weapon.Activate();
 }