public override void Awake() { Stomach = new UrbComposition(); FoodScents = UrbSubstances.Scent(FoodSubstances); DetectedFood = new List <UrbBody>(); base.Awake(); }
public UrbScentTag[] GetScent() { if (Dirty) { List <UrbScentTag> ScentList = new List <UrbScentTag>(); /* TODO: This may never be the prefered solution but it has some logic to it. * if (Membrane != null && Membrane.Layers != null && Membrane.Layers.Length > 0) * { * for(int i = 0; i < Membrane.Layers.Length; i++) * { * if (this[Membrane.Layers[i]] > 0.0) * { * UrbScentTag[] Scents = UrbSubstances.Scent(Membrane.Layers[i]); * for (int s = 0; s < Scents.Length; s++) * { * if (ScentList.Contains(Scents[s])) * { * continue; * } * ScentList.Add(Scents[s]); * } * } * } * } * else*/ { foreach (UrbSubstanceTag tag in Substances.Keys) { if (this[tag] > 0.0) { UrbScentTag[] Scents = UrbSubstances.Scent(tag); for (int s = 0; s < Scents.Length; s++) { if (ScentList.Contains(Scents[s])) { continue; } ScentList.Add(Scents[s]); } } } } CachedScents = ScentList.ToArray(); Dirty = false; } return(CachedScents); }
public static UrbScentTag[] Scent(UrbSubstanceTag[] input) { List <UrbScentTag> ScentList = new List <UrbScentTag>(); for (int i = 0; i < input.Length; i++) { UrbScentTag[] Scents = UrbSubstances.Scent(input[i]); for (int s = 0; s < Scents.Length; s++) { if (ScentList.Contains(Scents[s])) { continue; } ScentList.Add(Scents[s]); } } return(ScentList.ToArray()); }