Example #1
0
    public override bool TrySpendResources(int resourcesCount)
    {
        if (Count < resourcesCount)
        {
            return(false);
        }

        Count -= resourcesCount;
        OnChangedResourcesCount?.Invoke(Count);

        SaveResource();

        StartResourceRecovery();

        return(true);
    }
Example #2
0
 protected override void LoadResource()
 {
     Count = PlayerPrefs.GetInt("Energy");
     OnChangedResourcesCount?.Invoke(Count);
 }