public AIOneRunStatus Run() { if (_taskStatus == AITaskStatus.Succeded || _taskStatus == AITaskStatus.Failed) { Preconditions.Fail("Task was arleady completed, its state is " + _taskStatus); return(AIOneRunStatus.Succeded); } if (!_wasStarted) { _wasStarted = true; InternalStart(); } _listeners.ForEach(c => c.OnRunStarted(this)); var result = InternalRun(); if (result == AIOneRunStatus.Failed) { _taskStatus = AITaskStatus.Failed; } else if (result == AIOneRunStatus.Succeded) { _taskStatus = AITaskStatus.Succeded; } else { _taskStatus = AITaskStatus.Running; } _listeners.ForEach(c => c.OnRunCompleted(this, result)); return(result); }
public void Reset() { _taskStatus = AITaskStatus.Fresh; _wasStarted = false; Debug.Log("RESET TASKA< DODAJ DO UI"); }