private void InitFields()
        {
            _transform = transform;
            try
            {
                _pirate = GetComponent <IPirate>();
            }
            catch
            {
                throw new NullReferenceException("No component that implements the IFactoryLevel interface was found.");
            }

            try
            {
                _wheel = _spaceshipWheel.GetComponent <IWheel>();
            }
            catch
            {
                throw new NullReferenceException("Wheel field must not be null.");
            }

            try
            {
                _motor = _spaceshipMotor.GetComponent <IMotor>();
            }
            catch
            {
                throw new NullReferenceException("No component that implements the IMotor interface was found.");
            }
        }
Exemple #2
0
 private static void ensureRoverIsDeployed(IPirate pirate)
 {
     if (!pirate.IsDeployed())
     {
         throw new ReportException("Rapor oluşturulamamıştır.");
     }
 }
        public List <ICargo> DeliverCargo(IPirate pirate)
        {
            var tempCargo = _cargos;

            pirate.StealCargos(_cargos);
            _cargos.Clear();
            return(tempCargo);
        }
Exemple #4
0
        public void SendCargo(IPirate pirate, Resource.Type resourceType)
        {
            var tempCargo = _cargoGenerator.GenerateCargo(resourceType,
                                                          _minGeneratedResource,
                                                          _maxGeneratedResource,
                                                          MultiplierCalculator.CalculateGeneratedResourceMultiplier(_factoryLevel.GetLevel()));

            pirate.StealCargo(tempCargo);
            IsRobbed = true;
        }
Exemple #5
0
        private void Awake()
        {
            _pirate = _piratePrefab.GetComponent <IPirate>();
            _guide  = _pirateGuide.GetComponent <IPirateGuide>();
            if (_pirate == null)
            {
                throw new NullReferenceException("Pirate Prefab field ERROR. No component that implements the IPirate interface was found.");
            }
            if (_guide == null)
            {
                throw new NullReferenceException("Pirate Guide field ERROR. No component that implements the IPirateGuide interface was found.");
            }

            if (_centralSun == null)
            {
                throw new Exception("Central Sun field must not be null.");
            }
        }
Exemple #6
0
 public void SetReceivers(IPirate _pirate, ISurface _Surface)
 {
     pirate  = _pirate;
     Surface = _Surface;
 }
Exemple #7
0
 public void SetReceiver(IPirate _pirate)
 {
     pirate = _pirate;
 }