예제 #1
0
    void Initializate()
    {
        if (UseAuto)
        {
            if (Size == 1)
            {
                x      = Random.Range(100, 200);
                y      = Random.Range(100, 200);
                points = 25;
            }
            if (Size == 2)
            {
                x      = Random.Range(200, 500);
                y      = Random.Range(200, 500);
                points = 100;
            }
            if (Size == 3)
            {
                x      = Random.Range(500, 900);
                y      = Random.Range(500, 900);
                points = 200;
            }
        }
        wingededge = ScriptableObject.CreateInstance("WingedEdge") as WingedEdge;

        for (int i = 0; i < points; i++)
        {
            pointlist.Add(new Vector3(Random.Range(0.0f, x), 0.0f, Random.Range(0.0f, y)));
        }

        wingededge.AddVertex(0.0f, 0.0f, 0.0f);
        wingededge.AddVertex(0.0f, 0.0f, y);
        wingededge.AddVertex(x, 0.0f, y);
        wingededge.AddVertex(x, 0.0f, 0.0f);

        wingededge.AddFace(wingededge.Vertices[0], wingededge.Vertices[1], wingededge.Vertices[2]);
        wingededge.AddFace(wingededge.Vertices[0], wingededge.Vertices[2], wingededge.Vertices[3]);

        Continue();
    }