public virtual void Run(Func <status> φ) { var adapter = GetComponent <UGigAdapter>(); if (!adapter) { adapter = gameObject.AddComponent <UGigAdapter>(); } adapter.call = φ; root = adapter; }
// PROVISIONAL // NOTE: 'inferNext' is needed because `Push` may be // called before `Start` which may auto-assign a root task public void Push(Func <status> φ, bool inferNext = true) { var next = root; if (inferNext && root == null) { next = GetComponent <UGig>(); } var gig = gameObject.AddComponent <UGigAdapter>(); gig.call = φ; gig.next = next; root = gig; }
// -------------------------------------------------------------- void Start() => root = root != null ? root : GetComponent <UGig>();