private void RunRotateTo(ref RotateTo newrotation) { var time = newrotation.Time; var rotateto = newrotation.NextRotation * (float)Math.PI / 180; if (time == 0) { this.Rotation = rotateto; newrotation.IsDone = true; newrotation.IsDoing = false; return; } if (!newrotation.IsDoing) { newrotation.IsDoing = true; oldRotation = Rotation; speedRotate = (rotateto - Rotation) / (time * 60); rotationTotalValue = Math.Abs(rotateto - Rotation); } var rotated = Math.Abs(Rotation - oldRotation); if (rotationTotalValue >= rotated && !newrotation.IsDone) { if (Math.Abs(rotationTotalValue - rotated) < Math.Abs(speedRotate)) { Rotation = rotateto; newrotation.IsDone = true; newrotation.IsDoing = false; } else { Rotation += speedRotate; } } else { newrotation.IsDone = true; newrotation.IsDoing = false; } }
public virtual void AddRotateTo(RotateTo rotateto) { _rotateList.Add(rotateto); }
public virtual void AddRotateTo(RotateTo rotateto) { Sprite.AddRotateTo(rotateto); }