private void LoadFrames()
    {
        loading = true;
        float  startTime    = Time.time;
        int    framesLoaded = 0;      // TODO: remove debug var
        string line;

        line = reader.ReadLine();

        if (line == null)
        {
            finished = true;
            return;
        }

        // get rid of open matrix bracket
        line = line.Trim('[');
        while (line != null)
        {
            // pull info from line
            int   delimLoc  = line.IndexOf(',');
            float frameTime = float.Parse(line.Substring(0, delimLoc));

            // Get colors
            Color[] colors = new Color[heatMapTex.width * heatMapTex.height];
            MatrixToHeatMap(line.Substring(delimLoc + 1), ref colors);

            // Add frame to list
            HeatMapFrame frame = new HeatMapFrame(frameTime, colors);
            drawer.AddFrame(frame);

            // check if times up
            if (Time.time - startTime >= Time.deltaTime * 0.75f)
            {
                break;
            }

            framesLoaded++;

            // Get next line
            line = reader.ReadLine();
        }

        DebugStopLoading(framesLoaded);
    }
Exemplo n.º 2
0
 public void AddFrame(HeatMapFrame frm)
 {
     frames.Add(frm);
 }