public override void Do() { TimedTask.createTask((timer) => { if (mSpeed > 0) { if (mActorImage.Opacity >= mEnd) { mActorImage.Opacity = mEnd; timer.Stop(); OnFinish(); } } else if (mSpeed < 0) { if (mActorImage.Opacity <= mEnd) { mActorImage.Opacity = mEnd; timer.Stop(); OnFinish(); } } mActorImage.Opacity += mSpeed; }, 0.01, true).Start(); }
public GameEventDelay(Action doWhat, double delay) { mDoWhat = (t) => doWhat(); mDelay = delay; mTimedTask = TimedTask.createTask(mDoWhat, mDelay); }