public float ExtractOutResource(ResourceStorage.Resource res, float amount) { float output = clamp(amount, ResourceOutput[(int)res]); ResourceOutput[(int)res] = clamp(ResourceOutput[(int)res] - output); return(output); }
public SimulationBuildingEnity() { ResouceAmount = new float[ResourceStorage.ResourceCount]; ResourceConsumptionPerSecond = new float[ResourceStorage.ResourceCount]; ResourceMaxAmount = new float[ResourceStorage.ResourceCount]; ConsumingResource = new bool[ResourceStorage.ResourceCount]; ConvertsTo = new ResourceStorage.Resource[ResourceStorage.ResourceCount]; ProduceRate = new float[ResourceStorage.ResourceCount]; ResourceOutput = new float[ResourceStorage.ResourceCount]; }
public float GetAvailableOutResource(ResourceStorage.Resource res) { return(ResourceOutput[(int)res]); }
public float GetResourceConsumption(ResourceStorage.Resource res) { return(ResourceConsumptionPerSecond[(int)res]); }
public float GetMaxResourceAmount(ResourceStorage.Resource res) { return(ResourceMaxAmount[(int)res]); }
public float GetResource(ResourceStorage.Resource res) { return(ResouceAmount[(int)res]); }
public void AddResource(ResourceStorage.Resource res, float amount) { ResouceAmount[(int)res] = clamp(ResouceAmount[(int)res] + amount); }