コード例 #1
0
        void OnDrawGizmos()
        {
            if (!Application.isPlaying)
            {
                Init();
            }

            Gizmos.DrawWireSphere(polygon.Center, gizmosSize);
            polygon.DrawEdges();

            Polygon fake = PolygonManager.Create2D(polygon);

            fake.Translate(debugMovement);
            Gizmos.color = Color.gray;
            // fake.DrawEdges();

            List <Collider2D> collisions = fake.CheckCollisionsAt(fake.Center, polygonMask).ToList();// PolygonManager.CheckCollisions(fake);

            collisions.Remove(GetComponent <CircleCollider2D>());
            for (int i = 0; i < collisions.Count; i++)
            {
                Polygon        obstacle   = new RegularPolygon((CircleCollider2D)collisions[i], vertices);
                List <Vector2> o_vertices = obstacle.VerticesInside(fake);

                Gizmos.color = Color.white;
                obstacle.DrawEdges();

                DrawDebugCollision(fake, obstacle);
                fake.ProcessCollision(polygon, obstacle);
                Gizmos.color = Color.yellow;
                fake.DrawEdges();
            }
        }