Exemplo n.º 1
0
 public void SpendCarriedResource(int value)
 {
     carriedResource.value -= value;
     if (carriedResource.value <= 0)
     {
         carriedResource.Clear();
     }
     OnCarriedResourceChanged?.Invoke();
 }
Exemplo n.º 2
0
        public void AddResource(ResourceType type, int quantity)
        {
            if (carriedResource.type != ResourceType.None && carriedResource.type != type)
            {
                Debug.LogError($"Something is trying to add wrong resource type to {name}.");
                return;
            }

            if (carriedResource.type == ResourceType.None)
            {
                carriedResource.type = type;
            }

            carriedResource.value += quantity;
            OnCarriedResourceChanged?.Invoke();
        }
Exemplo n.º 3
0
 public void DropResources()
 {
     carriedResource.Clear();
     OnCarriedResourceChanged?.Invoke();
 }