public void addStep(int stepTime, int targetValue, int nextStepRel, int repeat) { _enabled = false; AnimStep s = new AnimStep(); s.stepTime = stepTime; s.targetValue = targetValue; s.nextStepRel = nextStepRel; s.repeat = repeat; s._stepTime = stepTime; s._repeat = repeat; _steps.Add(s); }
public void animate() { if (!_enabled || _stepIndex >= _steps.Count) { return; } AnimStep s = _steps[_stepIndex]; if (s._stepTime != 0) { if (s.targetValue >= 0) { _value += ((float)s.targetValue - _value) / (float)s._stepTime; } s._stepTime--; } else { while (s._stepTime == 0) { s._stepTime = s.stepTime; if (s.targetValue >= 0) { _value = s.targetValue; } if (s._repeat != 0) { if (s._repeat > 0) { s._repeat--; } _stepIndex += s.nextStepRel; } else { s._repeat = s.repeat; _stepIndex++; } s = _steps[_stepIndex]; } } }