public virtual float GiveTo(UrbAgent Target, UrbSubstanceTag Substance) { if (!Target.HasBody) { return(0); } float Amount = 0; UrbAction HoldAction = mAgent.PickAction(UrbTestCategory.Hold); if (HoldAction != null) { Amount = HoldAction.Execute(mAgent, Target); if (Target.IsGrasper) { Target.Grasper.TakeFrom(mAgent, Substance); } else if (Target.IsEater) { Amount = HeldComposition.TransferTo(Target.Eater.Stomach, Substance, Amount); } else { Amount = HeldComposition.TransferTo(Target.mBody.BodyComposition, Substance, Amount); } } return(Amount); }
public void ChangeComposition(UrbComposition Composition) { if (Composition == null) { Debug.LogError("Illegal Assignment: Cannot Change Composition to Null on UrbMembrane"); return; } if (MembraneLayers != null) { for (int i = 0; i < MembraneLayers.Length; i++) { ContainingComposition.TransferTo(Composition, MembraneLayers[i], float.MaxValue); } } ContainingComposition = Composition; }