Exemplo n.º 1
0
 /// <summary>
 /// Create a new Instance and set everything to default
 /// </summary>
 public CloneSettings()
 {
     pullfromstrinst = new StrIntsanceAlias[] { new StrIntsanceAlias(0x88, Data.MetaData.TXMT, "_txmt") };
     pullfromstr     = true;
     includeWallmask = true;
     exception       = true;
     updateguid      = true;
     onlydefault     = true;
     loadanim        = false;
     keepmesh        = false;
     use3idr         = BaseResourceType.Objd;
 }
    public void AddResource(BaseResourceType type, float value)
    {
        var resourceContainer = _availableResources.FirstOrDefault(r => r.ResourceType == type);

        if (resourceContainer != null)
        {
            resourceContainer.Count += value;
        }
        else
        {
            Debug.LogError("Resource type not found: " + type.ToString());
        }
    }
    public bool TryUseResource(BaseResourceType type, float count)
    {
        var resourceContainer = _availableResources.FirstOrDefault(r => r.ResourceType == type);

        if (resourceContainer == null)
        {
            Debug.LogError("Resource type not found: " + type.ToString());
            return(false);
        }

        if (resourceContainer.Count >= count)
        {
            resourceContainer.Count -= count;
            return(true);
        }

        return(false);
    }
Exemplo n.º 4
0
 public BaseResourceContainer(BaseResourceType type, float initialCount, float maxCount)
 {
     _type    = type;
     Capacity = maxCount;
     Count    = initialCount;
 }