/// <summary> /// Constructor method for the Stepper class. /// </summary> /// <param name="_stepValue">Execution frequency for this stepper. Default (1) means every frame</param> /// <param name="callback">Name of method to be called. Should be provided as the method name, i.e. MethodName, not "MethodName" or MethodName()</param> /// <param name="_stepperQueuePrompt">Where to place the stepper in the scheduler queue, using StepperQueueOrder values (EARLY, NORMAL, LATE)</param> /// <param name="_owner">The agent this stepper belongs to</param> public Stepper(int _stepValue, Utilities.Del callback, StepperQueueOrder _stepperQueuePrompt, Steppable _owner) { _step = _stepValue; funcToCall = callback; _stepperQueue = _stepperQueuePrompt; _name = callback.Method.Name; _startFrame = Time.frameCount; owner = _owner; switch (stepperQueue) { case StepperQueueOrder.EARLY: _priority = 166; break; case StepperQueueOrder.NORMAL: _priority = 500; break; case StepperQueueOrder.LATE: _priority = 833; break; default: _priority = 500; break; } }
/// <summary> /// Constructor method for the Stepper class. /// </summary> /// <param name="_stepValue">Execution frequency for this stepper. Default (1) means every frame</param> /// <param name="callback">Name of method to be called. Should be provided as the method name, i.e. MethodName, not "MethodName" or MethodName()</param> /// <param name="_priorityValue">Where to place the stepper in the scheduler queue, using priority values (soft range 0-1000, lower is earlier)</param> /// <param name="_owner">The agent this stepper belongs to</param> public Stepper(int _stepValue, Utilities.Del callback, int _priorityValue, Steppable _owner) { _step = _stepValue; funcToCall = callback; _priority = _priorityValue; _name = callback.Method.Name; _startFrame = Time.frameCount; owner = _owner; if (priority < 333) { _stepperQueue = Stepper.StepperQueueOrder.EARLY; } else if (priority < 666) { _stepperQueue = Stepper.StepperQueueOrder.NORMAL; } else { _stepperQueue = Stepper.StepperQueueOrder.LATE; } }