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); }
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); }
internal ShipModel(ShipData data) { _data = data; }
internal ShipInitializer(ShipData data, IPool <GameObject> providersPool, IShipWeapon weapon) { _data = data; _providersPool = providersPool; _weapon = weapon; }