protected void SetDataHolder<T, U, V>(TraitedMonoBehaviour sentObj, IDataHoldable<U, V> sentDataHolder) where T : TraitBase, IDataRetrievable<U, V> { T[] traits = sentObj.GetArray<T>(); for (int i = 0; i < traits.Length; i++) { traits[i].DataHolder = sentDataHolder; } }
private void SetTraitActions <T, U>(TraitedMonoBehaviour sentObj, Action <U> sentAction) where T : TraitBase, ISendable <U> { TraitBase[] traits = sentObj.GetArray(); for (int i = 0; i < traits.Length; i++) { if (traits[i] is T) { T newT = (T)traits[i]; newT.SendAction = sentAction; } } }
protected void SetTraitFunctions<T, U, V>(TraitedMonoBehaviour sentObj, Func<U, V> sentFunc) where T : TraitBase, IReceivable<U, V> { TraitBase[] traits = sentObj.GetArray(); for (int i = 0; i < traits.Length; i++) { if (traits[i] is T) { T newT = (T)traits[i]; newT.ReceiveFunction = sentFunc; } } }
private void PassDelegatesToTraits(TraitedMonoBehaviour sentObj) { SetTraitActions <InstructionTrait, InstructionData[]>(sentObj, PassInstructionToManagers); }
public override void PassDelegatesToTraits(TraitedMonoBehaviour sentObj) { SetTraitActions <UICanvasTrait, UICanvas>(sentObj, SetActiveCanvas); }
public void RaiseTraitsFound(TraitedMonoBehaviour sentObj) { if (OnTraitsFound == null) { return; } OnTraitsFound(sentObj); }
public virtual void PassDelegatesToTraits(TraitedMonoBehaviour sentObj) { }