コード例 #1
0
ファイル: ShipCreator.cs プロジェクト: prazdni/Unity4
        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);
        }
コード例 #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);
        }
コード例 #3
0
 internal ShipModel(ShipData data)
 {
     _data = data;
 }
コード例 #4
0
 internal ShipInitializer(ShipData data, IPool <GameObject> providersPool, IShipWeapon weapon)
 {
     _data          = data;
     _providersPool = providersPool;
     _weapon        = weapon;
 }