예제 #1
0
        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.");
            }
        }
예제 #2
0
 public ResourcesServices(IResourcesStorage _resourcesStorage)
 {
     resourcesStorage = _resourcesStorage;
 }