private void Awake() { _spaceshipsStoragePort = GetComponent <ISpaceshipsStoragePort>(); if (_spaceshipsStoragePort == null) { throw new NullReferenceException("No component that implements the ISpaceshipsStoragePort interface was found."); } }
private void Awake() { _transform = transform; _spaceshipsStoragePort = GetComponent <ISpaceshipsStoragePort>(); _cargoLoaderForShips = GetComponent <ICargoLoader>(); _resourceRarity = GetComponent <IResourceRarity>(); _factory = GetComponent <IFactory>(); if (_spaceshipsStoragePort == null) { throw new NullReferenceException("No component that implements the ISpaceshipsStoragePort interface was found."); } if (_cargoLoaderForShips == null) { throw new NullReferenceException("No component that implements the ICargoLoader interface was found."); } if (_resourceRarity == null) { throw new NullReferenceException("No component that implements the IResourceRarity interface was found."); } if (_factory == null) { throw new NullReferenceException("Factory component not found."); } else { if (_factory.GetIsActive()) { StartShipSendRoutine(); } else { _factory.AddListenerForOnActivate(StartShipSendRoutine); } } }