public bool step(float interval) { if (m_loc >= m_trackLength) return true; float next = m_rand.Next(1, 16); next /= 16; float stepDistance = (float) (m_trackLength*next); finishTweens(); int startX = m_loc; int finalX = (int) (startX + stepDistance); finalX = finalX; TweenAction action = new TweenAction(interval, new Linear(), percent => { int newX = (int) (startX + (finalX - startX)*percent); m_loc = newX; if (m_loc >= m_trackLength) { m_handler.win(this); } }); addTweenAction(action); return false; }
public void addTweenAction(TweenAction action) { m_tweenActions.Add(action); }