Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public virtual void AddRotateTo(RotateTo rotateto)
 {
     _rotateList.Add(rotateto);
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
 public virtual void AddRotateTo(RotateTo rotateto)
 {
     _rotateList.Add(rotateto);
 }
Exemplo n.º 5
0
 public virtual void AddRotateTo(RotateTo rotateto)
 {
     Sprite.AddRotateTo(rotateto);
 }
Exemplo n.º 6
0
 public virtual void AddRotateTo(RotateTo rotateto)
 {
     Sprite.AddRotateTo(rotateto);
 }