void Update()
    {
        //Get all Data from the data Reader one time
        if (incrementOnce < 2)
        {
            if (incrementOnce == 1)
            {
                //Grab Data
                //Set PieChart of initial state instantly.
                allData = ballScript.get_data();
                string[] testData = (string[])allData[dataIndex];
                mData = getDataFromString(testData[1]);
                dataIndex++;
                mPieChart.Draw(mData);
            }
            incrementOnce++;
        }

        if (enterTrigger)
        {
            //Update piechart whenever enter trigger zone
            //Stop updating when reach end of array = no more data
            if (dataIndex < allData.Count)
            {
                string[] testData = (string[])allData[dataIndex];
                mData = getDataFromString(testData[1]);
                dataIndex++;
                mPieChart.Draw(mData);
            }
            enterTrigger = false;
        }
    }
    void SetupPieChart()
    {
        mPieChart = gameObject.AddComponent("PieChartMesh") as PieChartMesh;
        if (mPieChart != null)
        {
            mPieChart.Init(mData, 100, 0, 100, null);

            if (DataSaver.Instance.highScores != null)
            {
                mData = new float[4];
                foreach (var score in DataSaver.Instance.highScores)
                {
                    mData[0] = score.RedWins;
                    mData[1] = score.BlueWins;
                    mData[2] = score.GreenWins;
                    mData[3] = score.PinkWins;
                }
            }
            else
            {
                defaultValues = new float[4] { 0, 0, 0, 0 };
                mData = defaultValues;
            }
            mPieChart.Draw(mData);
        }
    }
Exemplo n.º 3
0
    void SetupPieChart()
    {
        mPieChart = gameObject.AddComponent("PieChartMesh") as PieChartMesh;
        if (mPieChart != null)
        {
            mPieChart.Init(mData, 100, 0, 100, null);

            if (DataSaver.Instance.highScores != null)
            {
                mData = new float[4];
                foreach (var score in DataSaver.Instance.highScores)
                {
                    mData[0] = score.RedWins;
                    mData[1] = score.BlueWins;
                    mData[2] = score.GreenWins;
                    mData[3] = score.PinkWins;
                }
            }
            else
            {
                defaultValues = new float[4] {
                    0, 0, 0, 0
                };
                mData = defaultValues;
            }
            mPieChart.Draw(mData);
        }
    }
Exemplo n.º 4
0
    public void InitPieChart(Team team, int number)
    {
        mPieChart = gameObject.AddComponent <PieChartMesh>();

        float[] datas = new float[number];

        if (number == 4)
        {
            datas[0] = team.t_serve_score;
            datas[1] = team.t_attack_score;
            datas[2] = team.t_block_score;
            datas[3] = team.t_enemy_fail;
        }
        else if (number == 6)
        {
            datas[0] = team.t_serve_fail;
            datas[1] = team.t_attack_fail;
            datas[2] = team.t_block_fail;
            datas[3] = team.t_team_fail;
            datas[4] = team.t_duel_fail;
            datas[5] = team.t_defend_fail;
        }

        if (mPieChart != null)
        {
            mPieChart.Init(datas, 100, 0, 100, null);
            mPieChart.Draw(datas);
        }
    }
 void Update()
 {
     if (Input.GetKeyDown("a"))
     {
         mData = GenerateRandomValues(4);
         mPieChart.Draw(mData);
     }
 }
 void Start()
 {
     mPieChart = gameObject.AddComponent <PieChartMesh>() as PieChartMesh;
     if (mPieChart != null)
     {
         mPieChart.Init(mData, 100, 0, 100, null);
         mData = GenerateRandomValues(4);
         mPieChart.Draw(mData);
     }
 }
Exemplo n.º 7
0
 void Start()
 {
     mPieChart = gameObject.AddComponent("PieChartMesh") as PieChartMesh;
     if (mPieChart != null)
     {
         mPieChart.Init(mData, 100, 0, 100, null);
         mData = GenerateRandomValues(4);
         mPieChart.Draw(mData);
     }
 }
 void Update()
 {
     if (Input.GetKeyDown("a"))
     {
         randomBuffer = Random.state;
         //Random.seed = 10;
         mData = GenerateRandomValues(segments);
         mPieChart.Draw(mData);
         //Random.seed = randomBuffer;
     }
 }
    //=====================

    void Start()
    {
        //Get Data from dataReader
        ballScript = GameObject.Find("leftwall").GetComponent <dataReader> ();
        //========
        mPieChart = gameObject.AddComponent("PieChartMesh") as PieChartMesh;
        if (mPieChart != null)
        {
            mPieChart.Init(mData, 10, 0, 10, null);
            mData = initialArray();
            mPieChart.Draw(mData);
        }

        //SetTrigger as false so it doesn't update at the start
        enterTrigger = false;
    }
    void Start()
    {
        randomBuffer = Random.state;
        Random.InitState(10);

        materials = new Material[segments];
        for (int i = 0; i < segments; i++)
        {
            materials[i]       = new Material(mainMaterial);
            materials[i].color = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)255);
            //Debug.LogError(materials[i].color);
        }

        mPieChart = gameObject.AddComponent <PieChartMesh>() as PieChartMesh;
        if (mPieChart != null)
        {
            mPieChart.Init(mData, 100, 0, 100, materials, delay);
            mData = GenerateRandomValues(segments);
            mPieChart.Draw(mData);
        }
        Random.state = randomBuffer;
    }
Exemplo n.º 11
0
 // Use this for initialization
 void FixedUpdate()
 {
     pie.Init(mData, 100, mRotationAngle, mRadius);
     pie.Draw();
 }