/// <summary> /// Moves the value of resourceCollected to the elevatormanager and sets the value held by the elevator/this object to 0. /// </summary> private void DropOffResources() { elevatorManager.AddResources(resourceCollected); elevatorManager.UpdateResourceCounterTextMesh(); resourceCollected = 0f; UpdateResourceCounterTextMesh(); }
/// <summary> /// This method is responsible for removing resources from the elevator and adding them to the elevator building. /// </summary> void CollectResource() { if (resourceCollected < capacity) { float spaceAvailable = capacity - resourceCollected; float resourceAvailable = Mathf.Clamp(elevatorManager.ResourceHeld, 0f, spaceAvailable); elevatorManager.RemoveResources(resourceAvailable); elevatorManager.UpdateResourceCounterTextMesh(); resourceCollected += resourceAvailable; UpdateResourceCounterTextMesh(); } }