private void InitFields() { _resourcesStorage = GetComponent <IResourcesStorage>(); _collider = GetComponent <Collider2D>(); _rigidbody = GetComponent <Rigidbody2D>(); if (_resourcesStorage == null) { throw new NullReferenceException("No component that implements the IResourcesStorage interface was found."); } if (_collider == null) { throw new Exception("Collider component not found."); } if (_rigidbody == null) { throw new Exception("Rigidbody2D component not found."); } }
public ResourcesServices(IResourcesStorage _resourcesStorage) { resourcesStorage = _resourcesStorage; }