private void DrawNormalTensionPlatform(DevicePanel d, int x, int y, int Transparency, int amplitudeX, int amplitudeY, int angle, bool hasTension, int AttributeFrameID, Func <DevicePanel, int, int, int, System.Drawing.Color, bool> DrawCall = null)
        {
            if ((amplitudeX != 0 || amplitudeY != 0))
            {
                double xd           = x;
                double yd           = y;
                double x2           = x + amplitudeX - amplitudeX / 3.7;
                double y2           = y + amplitudeY - amplitudeY / 3.7;
                double radius       = Math.Pow(x2 - xd, 2) + Math.Pow(y2 - yd, 2);
                int    radiusInt    = (int)Math.Sqrt(radius);
                int    newX         = (int)(radiusInt * Math.Cos(Math.PI * angle / 128));
                int    newY         = (int)(radiusInt * Math.Sin(Math.PI * angle / 128));
                int    tensionCount = radiusInt / 16;

                d.DrawLine(x, y, x + newX, y - newY, System.Drawing.Color.Yellow, 3);
                d.DrawEllipse(x, y, amplitudeX, amplitudeY, System.Drawing.Color.White, 1);

                if (hasTension)
                {
                    for (int i = 0; i < tensionCount; i++)
                    {
                        int[] linePoints = RotatePoints(x + (16) * i, y, x, y, angle);
                        int   currentX   = linePoints[0];
                        int   currentY   = linePoints[1];
                        if (i == 0)
                        {
                            //Tension Center
                            var AnimationCenter = LoadAnimation(GetSetupAnimation(), d, 1, 2);
                            DrawTexturePivotNormal(d, AnimationCenter, AnimationCenter.RequestedAnimID, AnimationCenter.RequestedFrameID, currentX, currentY, Transparency);
                        }
                        else
                        {
                            //Tension Bar Segment
                            var AnimationRow = LoadAnimation(GetSetupAnimation(), d, 1, 1);
                            DrawTexturePivotNormal(d, AnimationRow, AnimationRow.RequestedAnimID, AnimationRow.RequestedFrameID, currentX, currentY, Transparency);
                        }
                    }
                }

                if (DrawCall != null)
                {
                    DrawCall(d, x + newX, y - newY, Transparency, System.Drawing.Color.FromArgb(255, 255, 255, 255));
                }
                else
                {
                    if (AttributeFrameID <= -1)
                    {
                        return;
                    }
                    string AnimName  = GetSetupAnimation();
                    var    Animation = LoadAnimation(AnimName, d);
                    if (LastFrameIDAttribute != AttributeFrameID)
                    {
                        UpdateRealAttributeFrameID(Animation, AttributeFrameID);
                    }
                    DrawTexturePivotNormal(d, Animation, RealAnimID, RealFrameID, x + newX, y - newY, Transparency);
                    //DrawHitbox(d, Animation, GetSetupAnimation(), System.Drawing.Color.FromArgb(128, 0, 255, 0), RealAnimID, RealFrameID, x + newX, y - newY, Transparency, false, false, 0);
                }
            }
        }
Example #2
0
        private void DrawCircleBumperNormal(DevicePanel d, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, int x, int y, int Transparency, int amplitudeX, int amplitudeY, int angle)
        {
            if ((amplitudeX != 0 || amplitudeY != 0))
            {
                double xd        = x;
                double yd        = y;
                double x2        = x + amplitudeX - amplitudeX / 3.7;
                double y2        = y + amplitudeY - amplitudeY / 3.7;
                double radius    = Math.Pow(x2 - xd, 2) + Math.Pow(y2 - yd, 2);
                int    radiusInt = (int)Math.Sqrt(radius);
                int    newX      = (int)(radiusInt * Math.Cos(Math.PI * angle / 128));
                int    newY      = (int)(radiusInt * Math.Sin(Math.PI * angle / 128));

                d.DrawLine(x, y, x + newX, y - newY, System.Drawing.Color.Yellow, 3);
                d.DrawEllipse(x, y, amplitudeX, amplitudeY, System.Drawing.Color.White, 2);

                DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, (x + newX), (y - newY), Transparency);
            }
            else
            {
                DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency);
            }
        }