public CommandTaskProcess(Action <CancellationToken> task) { m_Activation = async() => { if (m_TokenSource != null) { iStop(); // restart if running } m_TokenSource = new CancellationTokenSource(); // run task var token = m_TokenSource.Token; await Task.Run(() => task(token), token); // could be complete of iStop if (m_TokenSource != null) { // clear data lock (m_TokenSource) { m_TokenSource.Dispose(); m_TokenSource = null; } // notify commandValidator m_Validator.iSucceeded(this); } }; }
public CommandTask(Action task) { m_Activation = async() => { // run task await Task.Run(task); m_Validator.iSucceeded(this); }; }
public CommandLeanTween(LTDescr leanTween) { m_LeanTween = leanTween; m_LeanTween.pause(); m_Seq = LeanTween.sequence(); m_Seq .append(m_LeanTween) .append(() => m_CommandValidator.iSucceeded(this)); }
public void iSucceeded(ICommand command) { if (m_IterationsCurrent >= m_IterationsCount) { m_CommandValidator.iSucceeded(command); } else { m_IterationsCount++; m_Action.iStart(this); } }
public void iSucceeded() { if (m_CurrentCommand.Next != null) { m_CommandNotifier.iSucceeded(m_CurrentCommand.Value); m_CurrentCommand = m_CurrentCommand.Next; m_CommandInvoker.iInvoke(m_CurrentCommand.Value, this); } else { m_State = State.Succeeded; m_CommandNotifier.iSucceeded(null); m_CommandValidator?.iSucceeded(); } }
public void iSucceeded(ICommand command) { OnSucceeded?.Invoke(); m_TaskHandle.iSucceeded(command); }
////////////////////////////////////////////////////////////////////////// public void iStart(ICommandValidator validator) { validator.iSucceeded(this); m_Action?.Invoke(); }
////////////////////////////////////////////////////////////////////////// public void iStart(ICommandValidator validator) { validator.iSucceeded(this); }
////////////////////////////////////////////////////////////////////////// public void iStart(ICommandValidator validator) { Debug.Log(m_LogText); validator.iSucceeded(this); }
////////////////////////////////////////////////////////////////////////// public void iStart(ICommandValidator validator) { m_Coroutine = m_CoroutineOwner.StartCoroutine(Core.WaitAndDo(m_Time, () => validator.iSucceeded(this))); }
public void iSucceeded() { OnSucceeded?.Invoke(); m_TaskHandle.iSucceeded(); }
////////////////////////////////////////////////////////////////////////// public void iStart(ICommandValidator validator) { m_Coroutine = Core.StartWaitTimeAndDo(m_Time, () => validator.iSucceeded()); }