Exemplo n.º 1
0
 public void Init()
 {
     Hide();
     CurrentOrigin          = OriginState.Fire;
     InternalChild.Rotation = 0;
     InternalChild.Anchor   = Anchor.Centre;
     InternalChild.Origin   = Anchor.Centre;
     InternalChild.MoveTo(new Vector2(0, 0));
     ice.MoveToX(0);
     InternalChild.ClearTransforms();
 }
Exemplo n.º 2
0
        public void ChangeOrigin()
        {
            float xPos;
            float yPos;
            float radian;

            switch (CurrentOrigin)
            {
            case OriginState.Fire:
                radian = MathHelper.DegreesToRadians(getAngle());
                xPos   = (float)(getDistance() * Math.Cos(radian));
                yPos   = (float)(getDistance() * Math.Sin(radian));

                float width  = InternalChild.Width - ice.OriginPosition.X;
                float height = InternalChild.Height - ice.OriginPosition.Y;

                InternalChild.OriginPosition = new Vector2(width, height);

                if (InternalChild.Rotation > 0 && InternalChild.Rotation < 90)
                {
                    InternalChild.MoveToOffset(new Vector2(xPos, yPos));
                }

                else if (InternalChild.Rotation > 90 && InternalChild.Rotation < 180)
                {
                    InternalChild.MoveToOffset(new Vector2(-xPos, yPos));
                }

                else if (InternalChild.Rotation > 180 && InternalChild.Rotation < 270)
                {
                    InternalChild.MoveToOffset(new Vector2(-xPos, -yPos));
                }

                else if (InternalChild.Rotation > 270 && InternalChild.Rotation < 360)
                {
                    InternalChild.MoveToOffset(new Vector2(xPos, -yPos));
                }

                else
                {
                    if (InternalChild.Rotation == 0 || InternalChild.Rotation == 360)
                    {
                        InternalChild.MoveToOffset(new Vector2(xPos, 0));
                    }

                    else if (InternalChild.Rotation == 90)
                    {
                        InternalChild.MoveToOffset(new Vector2(0, -yPos));
                    }

                    else if (InternalChild.Rotation == 180)
                    {
                        InternalChild.MoveToOffset(new Vector2(-xPos, 0));
                    }

                    else if (InternalChild.Rotation == 270)
                    {
                        InternalChild.MoveToOffset(new Vector2(0, yPos));
                    }
                }

                CurrentOrigin = OriginState.Ice;
                break;

            case OriginState.Ice:
                radian = MathHelper.DegreesToRadians(getAngle());
                xPos   = (float)(getDistance() * Math.Cos(radian));
                yPos   = (float)(getDistance() * Math.Sin(radian));

                InternalChild.Origin = Anchor.Centre;

                if (InternalChild.Rotation > 0 && InternalChild.Rotation < 90)
                {
                    InternalChild.MoveToOffset(new Vector2(-xPos, -yPos));
                }

                else if (InternalChild.Rotation > 90 && InternalChild.Rotation < 180)
                {
                    InternalChild.MoveToOffset(new Vector2(xPos, -yPos));
                }

                else if (InternalChild.Rotation > 180 && InternalChild.Rotation < 270)
                {
                    InternalChild.MoveToOffset(new Vector2(xPos, yPos));
                }

                else if (InternalChild.Rotation > 270 && InternalChild.Rotation < 360)
                {
                    InternalChild.MoveToOffset(new Vector2(-xPos, yPos));
                }

                else
                {
                    if (InternalChild.Rotation == 0 || InternalChild.Rotation == 360)
                    {
                        InternalChild.MoveToOffset(new Vector2(xPos, 0));
                    }

                    else if (InternalChild.Rotation == 90)
                    {
                        InternalChild.MoveToOffset(new Vector2(0, -yPos));
                    }

                    else if (InternalChild.Rotation == 180)
                    {
                        InternalChild.MoveToOffset(new Vector2(-xPos, 0));
                    }

                    else if (InternalChild.Rotation == 270)
                    {
                        InternalChild.MoveToOffset(new Vector2(0, yPos));
                    }
                }

                CurrentOrigin = OriginState.Fire;
                break;
            }
        }