Exemplo n.º 1
0
        /// <summary>
        /// 描画
        /// </summary>
        private void Draw()
        {
            if (!draw)
            {
                return;
            }
            //描画用簡易ポリゴンの作成
            drawEMeshes[0] = drawEMesh;                                                               //本体
            drawEMeshes[1] = EasyMesh.MakePolyLine2D(vertices, outlineWidth, lerpOutlineColor.Value); //アウトライン
            Mesh mesh = EasyMesh.ToMesh(drawEMeshes);

            //描画
            mf.mesh = mesh;
            if (mc)
            {
                if (!disabled)
                {
                    mc.sharedMesh = mesh;
                }
                else
                {
                    mc.sharedMesh = null;
                }
            }
            draw = false;
        }
Exemplo n.º 2
0
        public override EasyMesh GetEasyMesh(Color color)
        {
            List <Vector2> list = new List <Vector2>();

            list.Add(a);
            list.Add(b);
            return(EasyMesh.MakePolyLine2D(list, 0.1f, color));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 部分線の簡易メッシュを作成。(範囲指定)
        /// </summary>
        public EasyMesh MakeSubLineRange(float start, float end, float width, Color color)
        {
            //値確認
            if (start >= end)
            {
                return(null);
            }

            //下準備
            List <Vector2> points   = new List <Vector2>();
            float          range    = end - start;
            float          sumRange = 0f;
            int            i        = 0;

            //開始位置/終了位置を探す
            int startIndex = 0;
            int endIndex   = 0;

            for (; i < edges.Count; ++i)
            {
                if (sumRange <= start && start <= sumRange + edges[i].range)
                {
                    points.Add(edges[i].direction * (start - sumRange) + edges[i].a);
                    startIndex = 0;
                    break;
                }
                sumRange += edges[i].range;
            }
            for (; i < edges.Count; ++i)
            {
                if (sumRange <= end && end <= sumRange + edges[i].range)
                {
                    points.Add(edges[i].direction * (end - sumRange) + edges[i].a);
                    break;
                }
                points.Add(edges[i].b);
                sumRange += edges[i].range;
            }

            return(EasyMesh.MakePolyLine2D(points, width, color));
        }
Exemplo n.º 4
0
 /// <summary>
 /// 簡易メッシュを作成
 /// </summary>
 public EasyMesh MakeLine(float width, Color color)
 {
     return(EasyMesh.MakePolyLine2D(vertices, width, color));
 }