コード例 #1
0
    void Awake()
    {
        // Do not try to create run-time objects unless we are in play mode
        if (!Application.isPlaying)
        {
            return;
        }

        // Capture the graph
        captureGraph();

        // Setup the graph
        mGraph.setRanges(0, 500, 0, 1000);

        // Create the data we want to plot
        data1.Add(new Vector2(-50, -100));
        data1.Add(new Vector2(0, 0));
        data1.Add(new Vector2(50, 200));
        data1.Add(new Vector2(100, 200));
        data1.Add(new Vector2(150, 350));
        data1.Add(new Vector2(200, 400));
        data1.Add(new Vector2(250, 690));
        data1.Add(new Vector2(300, 800));
        data1.Add(new Vector2(350, 620));
        data1.Add(new Vector2(400, 800));
        data1.Add(new Vector2(450, 860));
        data1.Add(new Vector2(500, 1000));
        data1.Add(new Vector2(550, 1120));

        // Add a X/Y Plot the the graph and capture the plot and color it blue
        createPlot1();

        // Create a different set of data for the second plot
        data2.Add(new Vector2(-50, -100));
        data2.Add(new Vector2(0, 250));
        data2.Add(new Vector2(50, 75));
        data2.Add(new Vector2(100, 322));
        data2.Add(new Vector2(150, 200));
        data2.Add(new Vector2(200, 360));
        data2.Add(new Vector2(250, 210));
        data2.Add(new Vector2(300, 55));
        data2.Add(new Vector2(350, 175));
        data2.Add(new Vector2(400, 322));
        data2.Add(new Vector2(450, 260));
        data2.Add(new Vector2(500, 200));
        data2.Add(new Vector2(550, -50));

        // Add a second X/Y Plot the the graph and capture the plot and color it red
        createPlot2();
    }