public float Add (Resource resource, float value=0) { if (!resList.ContainsKey (resource.name)) { resList.Add (resource.name, new Resource (resource.name)); } resList [resource.name].Add (value); return resList [resource.name].value; }
public bool Merge (Resource resource) { if (resource.name == name) { value += resource.value; resource.Destroy (); return true; } return false; }
public float Remove (Resource resource, float value=0) { Resource res; if (resList.ContainsKey (resource.name)) { res = resList [resource.name]; res.Remove (value); if (res.value <= 0) { resList.Remove (res.name); } return res.value; } return 0; }
public void AddResource(Cosmos.Resource r) { population.AddResource(r); }