protected bool TaskLoopFunc(TimeTask task, ref float deltaTime) { TimeTaskAction action = task.TimeLine[task.TimeLineIndex]; if (!action.FuncBoolArg()) { task.TimeLineIndex++; return(true); } CallTask(task); return(false); }
protected bool TaskDelayFrame(TimeTask task, ref float deltaTime) { TimeTaskAction action = task.TimeLine[task.TimeLineIndex]; if (action.IntArgs[0] >= 0 && action.IntArgs[1] < action.IntArgs[0]) { action.IntArgs[1] += 1; deltaTime = 0; if (action.IntArgs[1] >= action.IntArgs[0]) { task.TimeLineIndex++; CallTask(task); return(true); } } return(false); }
protected bool TaskLoopTime(TimeTask task, ref float deltaTime) { TimeTaskAction action = task.TimeLine[task.TimeLineIndex]; if (action.FloatArgs[0] >= 0 && action.FloatArgs[1] <= action.FloatArgs[0]) { action.FloatArgs[1] += deltaTime; if (action.FloatArgs[1] > action.FloatArgs[0]) { deltaTime = action.FloatArgs[1] - action.FloatArgs[0]; task.TimeLineIndex++; return(true); } } CallTask(task); return(false); }
protected bool RunTask(TimeTask task, ref float deltaTime) { TimeTaskAction action = task.TimeLine[task.TimeLineIndex]; switch (action.Type) { case TimeTaskActionTypes.DelayFrame: return(TaskDelayFrame(task, ref deltaTime)); case TimeTaskActionTypes.DelayTime: return(TaskDelayTime(task, ref deltaTime)); case TimeTaskActionTypes.LoopFunc: return(TaskLoopFunc(task, ref deltaTime)); case TimeTaskActionTypes.LoopTime: return(TaskLoopTime(task, ref deltaTime)); case TimeTaskActionTypes.LoopFrame: return(TaskLoopFrame(task, ref deltaTime)); default: return(true); } }