public void Stop() { // reset velocities and acceleration _velocityX = 0; _velocityY = 0; _accelerationX = 0; _accelerationY = 0; // ignore if Sprite not moving via MovePoint if (Tile.TilesMoving.IndexOf(_parent) == -1) { return; } // remove from moving list Tile.TilesMoving.Remove(_parent); // raise the event if (Stopped != null) { Stopped(new SpriteMovementEventArgs(_parent, this)); } // clear the current MovePoint _movePoint = null; }
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(double totalTime, Rectangle destLoc) { // passing in a new MovePoint, so stop the other if it exists //Stop(); // set the new MovePoint _movePoint = new MovePoint(_parent, totalTime, destLoc); Start(); }
public void Start(double totalTime, PointF destCoord, Size destSize) { // passing in a new MovePoint, so stop the other if it exists //Stop(); // set the new MovePoint _movePoint = new MovePoint(_parent, totalTime, destCoord, destSize); Start(); }
public void AdjustCurrentMovementSpeed(double byFactorOf) { // adjust speed of MovePoint chain MovePoint movePt = _movePoint; while (movePt != null) { movePt.TotalTicks = (long)((double)movePt.TotalTicks * byFactorOf); movePt.TotalTicksRunning = (long)((double)movePt.TotalTicksRunning * byFactorOf); movePt = movePt.nextMovePoint; } // adjust velocities _velocityX *= byFactorOf; _velocityY *= byFactorOf; LimitVelocityXByTerminal(); LimitVelocityYByTerminal(); }
public void AddMovePoint(MovePoint movePt) { // if no existing MovePoint, or in a "looping" chain of MovePoints... if ((_movePoint == null) || (this.TimeRemaining == -1)) { _movePoint = movePt; } else { // find the last MovePoints in the stack MovePoint lastMove = _movePoint; while (lastMove.nextMovePoint != null) { lastMove = lastMove.nextMovePoint; } // add the new MovePoints to the end of the stack lastMove.nextMovePoint = movePt; } }
protected internal SpriteMovePointFinishedEventArgs(Sprite _sprite, Movement _movement, MovePoint _movePoint) { sprite = _sprite; movement = _movement; movePoint = _movePoint; }
public void Stop() { // reset velocities and acceleration _velocityX = 0; _velocityY = 0; _accelerationX = 0; _accelerationY = 0; // ignore if Sprite not moving via MovePoint if (Tile.TilesMoving.IndexOf(_parent) == -1) return; // remove from moving list Tile.TilesMoving.Remove(_parent); // raise the event if (Stopped != null) Stopped(new SpriteMovementEventArgs(_parent, this)); // clear the current MovePoint _movePoint = null; }
public void Start(double totalTime, Rectangle destLoc) { // passing in a new MovePoint, so stop the other if it exists //Stop(); // set the new MovePoint _movePoint = new MovePoint(_parent, totalTime, destLoc); Start(); }
public void Start(double totalTime, PointF destCoord, Size destSize) { // passing in a new MovePoint, so stop the other if it exists //Stop(); // set the new MovePoint _movePoint = new MovePoint(_parent, totalTime, destCoord, destSize); Start(); }
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 AddMovePoint(MovePoint movePt) { // if no existing MovePoint, or in a "looping" chain of MovePoints... if ((_movePoint == null) || (this.TimeRemaining == -1)) _movePoint = movePt; else { // find the last MovePoints in the stack MovePoint lastMove = _movePoint; while (lastMove.nextMovePoint != null) lastMove = lastMove.nextMovePoint; // add the new MovePoints to the end of the stack lastMove.nextMovePoint = movePt; } }