public void TryAddShip(ISpaceshipCargoHandler ship)
 {
     if (ship != null)
     {
         aceptedSpaceShips.Enqueue(ship);
     }
 }
 public void LoadCargoForShip(ISpaceshipCargoHandler ship, IFactory factory, ResourceRarity.ResourceInfo[] resourceInfo)
 {
     for (int i = 0; i < resourceInfo.Length; i++)
     {
         factory.SendCargo(ship, resourceInfo[i].GetResourceType());
     }
 }
Exemplo n.º 3
0
 public void AcceptShip(ISpaceshipCargoHandler ship)
 {
     if (ship == null)
     {
         throw new ArgumentNullException("ISpaceshipCargoHandler is null.");
     }
     ship.AcceptNow();
     _spaceshipsStoragePort.AddShip(ship);
 }
Exemplo n.º 4
0
 private void Awake()
 {
     base.DoAwakeWork();
     _transform    = transform;
     _cargoHandler = GetComponent <ISpaceshipCargoHandler>();
     if (_cargoHandler == null)
     {
         throw new NullReferenceException("No component that implements the ISpaceshipCargoHandler interface was found.");
     }
 }
Exemplo n.º 5
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            _tempCargoHandler = collision.GetComponent <ISpaceshipCargoHandler>();
            if (_tempCargoHandler != null && _tempCargoHandler.CheckCargo())
            {
                _tempCargoHandler.DeliverCargo(this);
                ObjectPooler.Instance.DestroyObject(_tempCargoHandler.GetUnityObject());
                StatsSystem.Instance.ReduceActiveShipsCount();
                return;
            }

            _tempCargoHandler = null;
        }
Exemplo n.º 6
0
 public void SendCargo(ISpaceshipCargoHandler ship, Resource.Type resourceType)
 {
     if (IsRobbed)
     {
         var voidCargo = Cargo.Void();
         ship.AcceptCargo(voidCargo);
         IsRobbed = false;
         return;
     }
     else
     {
         var tempCargo = _cargoGenerator.GenerateCargo(resourceType,
                                                       _minGeneratedResource,
                                                       _maxGeneratedResource,
                                                       MultiplierCalculator.CalculateGeneratedResourceMultiplier(_factoryLevel.GetLevel()));
         ship.AcceptCargo(tempCargo);
     }
 }
 public void AddShip(ISpaceshipCargoHandler ship)
 {
     aceptedSpaceShips.Enqueue(ship);
 }