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; } }
public void Move() { InternalChild.MoveToOffset(new Vector2(-size * 2, 0), (60000 / BPM), Easing.OutQuint); }