Beispiel #1
0
		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;
		}
Beispiel #2
0
		public bool Merge (Resource resource)
		{
			if (resource.name == name) {
				value += resource.value;			
				resource.Destroy ();
				return true;
			}
			return false;
		}
Beispiel #3
0
		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;
		}
Beispiel #4
0
 public void AddResource(Cosmos.Resource r)
 {
     population.AddResource(r);
 }