Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        ag.UpdateValue();
        tmp.text = "" + ArgsGetter.GetKcal(ArgsGetter.TargetHR) + "Kcal";
        switch (ArgsGetter.Intensity)
        {
        case 1:
            subText.text = "저강도로 오래 운동을 하면 체중 감소에 좋습니다.";
            break;

        case 2:
            subText.text = "중강도 운동은 심장과 근육을 단련하는 데에 좋습니다.";
            break;

        case 3:
            subText.text = "고강도 운동은 심장과 근육을 더욱 더 단련합니다.\n주의해서 플레이하세요.";
            break;

        default:
            subText.text = "";
            break;
        }
    }
Exemple #2
0
    void Awake()
    {
        LineRenderer r = GetComponent <LineRenderer>();
        //StringBuilder sb = new StringBuilder("hr, targetSPN(difficulty), avgDelta (real difficulty), hrthres\n");

        var file = File.ReadAllLines("log.csv").Select(s => s.Split(',')).ToList();

        file.RemoveAt(0);//remove header

        var hr_ = from string[] line in file select TryParse(line[0]);

        var hrThres_ = from string[] line in file select TryParse(line[3]);

        var hr      = hr_.ToList();
        var hrThres = hrThres_.ToList();

        hrSamples      = new float[sampleCount];
        hrThresSamples = new float[sampleCount];

        var fc             = file.Count;
        int linesPerSample = (fc / sampleCount) + 1;

        avgHR    = hr.Average();
        estkcal  = ArgsGetter.GetKcal(ArgsGetter.TargetHR);
        usedkcal = ArgsGetter.GetKcal(avgHR);

        for (int i = 0; i < sampleCount; i++)
        {
            int a    = Mathf.Min(fc - linesPerSample, (int)(((float)fc) / sampleCount * i));
            int from = Mathf.Max(0, a);
            Debug.Log(a + ", " + from);
            hrSamples[i]      = (float)Enumerable.Range(from, linesPerSample).Average(q => hr[q]);
            hrThresSamples[i] = (float)Enumerable.Range(from, linesPerSample).Average(q => hrThres[q]);
        }

        OnResize();
    }