Beispiel #1
0
    public void LoadTestParameters(ref AnimationCurve path, ref AnimationCurve actQuant, ref AnimationCurve visionDelay, ref AnimationCurve bump, ref AnimationCurve actDelay, ref AnimationCurve visQuant)
    {
        path              = new AnimationCurve();
        path.preWrapMode  = WrapMode.ClampForever;
        path.postWrapMode = WrapMode.ClampForever;
        path.AddKey(0, 0);


        actQuant              = new AnimationCurve();
        actQuant.preWrapMode  = WrapMode.ClampForever;
        actQuant.postWrapMode = WrapMode.ClampForever;
        actQuant.AddKey(0, 0);

        visionDelay              = new AnimationCurve();
        visionDelay.preWrapMode  = WrapMode.ClampForever;
        visionDelay.postWrapMode = WrapMode.ClampForever;
        visionDelay.AddKey(0, 0);

        bump              = new AnimationCurve();
        bump.preWrapMode  = WrapMode.ClampForever;
        bump.postWrapMode = WrapMode.ClampForever;
        bump.AddKey(0, 0);

        actDelay              = new AnimationCurve();
        actDelay.preWrapMode  = WrapMode.ClampForever;
        actDelay.postWrapMode = WrapMode.ClampForever;
        actDelay.AddKey(0, 0);

        visQuant              = new AnimationCurve();
        visQuant.preWrapMode  = WrapMode.ClampForever;
        visQuant.postWrapMode = WrapMode.ClampForever;
        visQuant.AddKey(0, 0);

        try
        {
            string       line;
            StreamReader theReader = new StreamReader(inputFilePath, System.Text.Encoding.Default);

            using (theReader)
            {
                float time;
                float pathVal;
                float actQuantVal;
                float visVal;
                float bumpVal;
                float actVal;
                float visQuantVal;

                do
                {
                    line = theReader.ReadLine();

                    if (line != null)
                    {
                        string[] entries = line.Split(',');


                        if (entries.Length > 0)
                        {
                            time        = Convert.ToSingle(entries[0]);
                            pathVal     = Convert.ToSingle(entries[1]);
                            bumpVal     = Convert.ToSingle(entries[2]);
                            actQuantVal = Convert.ToSingle(entries[3]);
                            actVal      = Convert.ToSingle(entries[4]);
                            visVal      = Convert.ToSingle(entries[5]);
                            visQuantVal = Convert.ToSingle(entries[6]);

                            path.AddKey(time, pathVal);
                            actQuant.AddKey(time, actQuantVal);
                            visionDelay.AddKey(time, visVal);
                            bump.AddKey(time, bumpVal);
                            actDelay.AddKey(time, actVal);
                            visQuant.AddKey(time, visQuantVal);

                            gameLength = (int)time + 1;
                        }
                    }
                }while (line != null);

                theReader.Close();
                return;
            }
        }

        /* If anything broke in the try block, we throw an exception with information
         * on what didn't work */
        catch (Exception e)
        {
            Debug.Log("ERROR: " + e.Message);
            return;
        }
    }