public void Finish(bool startNextMovePoint) { // don't do anything if there is not a current movePoint if (_movePoint == null) { return; } _parent.RenderSize = _movePoint.DestSize; _parent.MoveSprite(_movePoint.DestCoord); if (MovePointFinished != null) { MovePointFinished(new SpriteMovePointFinishedEventArgs(_parent, this, _movePoint)); } if (_movePoint.nextMovePoint == null) { Stop(); } else { _movePoint = _movePoint.nextMovePoint; _movePoint.InitializeMovePoint(); } // remove from moving list if startNextMovePoint is false // this will stop the Sprite movement until Start() is called again if (!startNextMovePoint) { Tile.TilesMoving.Remove(_parent); } }
public void Start() { // don't do anything if there is not a current movePoint if (_movePoint == null) { return; } // ignore if Sprite already moving if (Tile.TilesMoving.IndexOf(_parent) != -1) { return; } // reset velocities since using MovePoints _velocityX = 0; _velocityY = 0; // add Sprite to moving list Tile.TilesMoving.Add(_parent); _lastTick = HighResTimer.GetCurrentTickCount(); // initialize MovePoint values based on Sprite's current state _movePoint.InitializeMovePoint(); // raise the event if (Started != null) { Started(new SpriteMovementEventArgs(_parent, this)); } }
public void Finish(bool startNextMovePoint) { // don't do anything if there is not a current movePoint if (_movePoint == null) return; _parent.RenderSize = _movePoint.DestSize; _parent.MoveSprite(_movePoint.DestCoord); if (MovePointFinished != null) MovePointFinished(new SpriteMovePointFinishedEventArgs(_parent, this, _movePoint)); if (_movePoint.nextMovePoint == null) Stop(); else { _movePoint = _movePoint.nextMovePoint; _movePoint.InitializeMovePoint(); } // remove from moving list if startNextMovePoint is false // this will stop the Sprite movement until Start() is called again if (!startNextMovePoint) Tile.TilesMoving.Remove(_parent); }