public static bool TrySchedule(object animtoken, System.Action <object> callback) { if (callback == null) { throw new System.ArgumentNullException("callback"); } if (animtoken.IsNullOrDestroyed()) { return(false); } if (animtoken is ISPAnim) { (animtoken as ISPAnim).Schedule((a) => callback(a)); return(true); } else if (animtoken is IRadicalWaitHandle) { var handle = animtoken as IRadicalWaitHandle; if (handle.IsComplete) { callback(animtoken); } else { handle.OnComplete((h) => callback(h)); } return(true); } else if (animtoken is AnimationState) { //GameLoop.Hook.StartCoroutine((animtoken as AnimationState).ScheduleLegacy((a) => callback(a))); InvokeHandle.Begin(GameLoop.UpdatePump, () => callback(animtoken), ScheduleLegacyForInvokeHandle(animtoken as AnimationState)); return(true); } else { GameLoop.Hook.StartCoroutine(CoroutineUtil.Wait(animtoken, callback)); } return(false); }