Exemplo n.º 1
0
        public static void DrawEdge(EdgeCollider2D col, Color color)
        {
            List <Vector2> list = new List <Vector2>();

            foreach (var point in col.points)
            {
                list.Add(col.transform.TransformPoint(point + col.offset));
            }

            for (int i = 1; i < list.Count; i++)
            {
                DrawUtil.DrawLine(list[i - 1], list[i], color);
            }
        }
Exemplo n.º 2
0
        public static void DrawBox(BoxCollider2D col, Color color)
        {
            float halfSizeX = col.size.x / 2.0f;
            float halfSizeY = col.size.y / 2.0f;

            Vector2 v0 = col.transform.TransformPoint(col.offset.x - halfSizeX, col.offset.y - halfSizeY, 0f);
            Vector2 v1 = col.transform.TransformPoint(col.offset.x + halfSizeX, col.offset.y - halfSizeY, 0f);
            Vector2 v2 = col.transform.TransformPoint(col.offset.x + halfSizeX, col.offset.y + halfSizeY, 0f);
            Vector2 v3 = col.transform.TransformPoint(col.offset.x - halfSizeX, col.offset.y + halfSizeY, 0f);

            DrawUtil.DrawLine(v0, v1, color);
            DrawUtil.DrawLine(v1, v2, color);
            DrawUtil.DrawLine(v2, v3, color);
            DrawUtil.DrawLine(v3, v0, color);
        }
Exemplo n.º 3
0
        public static void DrawPolygon(PolygonCollider2D col, Color color)
        {
            List <Vector2> list = new List <Vector2>();

            foreach (var point in col.points)
            {
                list.Add(col.transform.TransformPoint(point + col.offset));
            }

            Vector2 last = list[0];
            Vector2 current;

            for (int i = 1; i < list.Count; i++)
            {
                current = list[i];
                DrawUtil.DrawLine(last, current, color);
                last = current;
            }
            DrawUtil.DrawLine(last, list[0], color);
        }
Exemplo n.º 4
0
        private static void OnFixedGUI(UnityModManager.ModEntry modEntry)
        {
            if (modEntry.Active)
            {
                DrawUtil.DrawText("HueDebugging enabled");
#if DEBUG
                System.Version version = Assembly.GetExecutingAssembly().GetName().Version;
                DrawUtil.DrawText("Version " + version.ToString());
#endif

                CollisionDrawer.DrawAllColliders();

                if (settings.PlayerGroundCheck)
                {
                    PlayerCollision.OnFixedGUI();
                }

                DrawUtil.OnFixedGUI();
            }
        }
Exemplo n.º 5
0
        public static void DrawCircle(CircleCollider2D col, Color color)
        {
            Vector2 last = col.transform.TransformPoint(col.radius * new Vector2(1, 0) + col.offset);
            Vector2 current;

            for (int i = 1; i <= circleEdgeCount; i++)
            {
                double rad = i * 2.0 * Math.PI / circleEdgeCount;

                float x = Convert.ToSingle(Math.Cos(rad));
                float y = Convert.ToSingle(Math.Sin(rad));

                Vector2 localPos = col.radius * new Vector2(x, y) + col.offset;

                current = col.transform.TransformPoint(localPos);

                DrawUtil.DrawLine(last, current, color);

                last = current;
            }
        }
Exemplo n.º 6
0
        public static void OnFixedGUI()
        {
            //Draw ground detection lines
            foreach (DrawUtil.Line line in lineList)
            {
                DrawUtil.DrawLine(line);
            }

            GameManager gm = GameManager.instance;

            if (gm == null)
            {
                return;
            }

            PlayerNew player = gm.Player;

            if (player == null)
            {
                return;
            }

            if (Main.settings.DisplayPlayerPositionAndVelocity)
            {
                DrawPlayerPosition(player);
            }

            if (player.door)
            {
                DrawUtil.DrawText("Door: " + player.door.doorID);
            }
            else
            {
                DrawUtil.DrawText("No door");
            }

            CollisionDrawer.DrawCircle(player.circleCollider, Color.white);
            CollisionDrawer.DrawCircle((CircleCollider2D)player.topCollider, Color.white);
        }