private PhysicalResource FindPhysical(PhysicalRef resourceName) { foreach (PhysicalResource p in Resources) { if (p.Name == resourceName) { return(p); } } return(null); }
public void AddToValue(PhysicalRef resourceName, float amount) { PhysicalResource pr = FindPhysical(resourceName); if (pr.PhysicalValue + (pr.Threshold * amount) > 1.0f) { pr.PhysicalValue = 1.0f; } else { pr.PhysicalValue += pr.Threshold * amount; } }
public float GetPhysicalThreshold(PhysicalRef resourceName) { return(FindPhysical(resourceName).Threshold); }
public float GetPhysicalDecay(PhysicalRef resourceName) { return(FindPhysical(resourceName).Decay); }
public float GetPhysicalValue(PhysicalRef resourceName) { return(FindPhysical(resourceName).PhysicalValue); }