示例#1
0
        public static void DrawVisibility(Vector2[] encounters, Vector2 lightposition, Color color = default(Color))
        {
            color = DebugDrawHelper.ValidateColor(color);

            for (int i = 1; i < encounters.Length; i++)
            {
                DebugDrawHelper.DrawLine(encounters[i - 1], encounters[i], color);
            }
        }
        public static void DrawHex(Layout layout, Hex hex, Color color, bool filled = false)
        {
            List <Point>   corners        = Layout.PolygonCorners(layout, hex);
            List <Vector2> arrayOfCorners = new List <Vector2>(corners.Count);

            foreach (Point corner in corners)
            {
                arrayOfCorners.Add(GridHelper.PointToVector2(corner));
            }

            DebugDrawHelper.DrawHex(arrayOfCorners.ToArray(), color, filled);
        }
        public static void DrawHex(Vector2[] corners, Color color = default(Color), bool filled = false)
        {
            if (corners.Length != 6)
            {
                return;
            }

            color = ValidateColor(color);

            Vector3 startPoint;
            Vector3 endPoint;

            if (!filled)
            {
                startPoint = corners[0];
                for (int i = 1; i < corners.Length; i++)
                {
                    endPoint = corners[i];

                    DebugDrawHelper.DrawLine(startPoint, endPoint, color, depthTest: false);

                    startPoint = endPoint;
                }
            }
            else
            {
                for (int i = 0; i < corners.Length; i++)
                {
                    startPoint = corners[i];
                    for (int j = 0; j < corners.Length; j++)
                    {
                        if (i == j)
                        {
                            continue;
                        }
                        endPoint = corners[j];

                        DebugDrawHelper.DrawLine(startPoint, endPoint, color, depthTest: false);
                    }
                }
            }
        }