float currRockstarVel;          // used to detect change in rockstar velocity for pMetric

    // Start is called before the first frame update
    void Start()
    {
        Setup();            // run initial setup, inherited from parent class

        InitConfigurable(); // initialize configurable values

        randomSeed = new System.Random(seed.GetHashCode());

        // set the leftKey for the intro instructions
        int tempIdx = lrkeyText.text.IndexOf("LKEY");

        lrkeyText.text = lrkeyText.text.Substring(0, tempIdx) + KeyCodeDict.toString[leftKey] + lrkeyText.text.Substring(tempIdx + 4);

        // set the rightKey for the intro instructions
        tempIdx        = lrkeyText.text.IndexOf("RKEY");
        lrkeyText.text = lrkeyText.text.Substring(0, tempIdx) + KeyCodeDict.toString[rightKey] + lrkeyText.text.Substring(tempIdx + 4);

        // set the upKey for the intro instructions
        tempIdx       = ukeyText.text.IndexOf("UKEY");
        ukeyText.text = ukeyText.text.Substring(0, tempIdx) + KeyCodeDict.toString[upKey] + ukeyText.text.Substring(tempIdx + 4);

        countDoneText = "Rock!";

        pMetric = new PositionMetric(new List <string> {
            "rockstar", "spotlight"
        });                                                                      // initialize position metric recorder
        lvMetric = new LinearVariableMetric(0f, 100f, 75f, new List <string> {
            "gameDrop", "playerRaise"
        });                                                                  // initialize linear variable metric recorder
        metricWriter = new MetricJSONWriter("Rockstar", DateTime.Now, seed); // initialize metric data writer

        rockstar.Init(seed, rockstarChangeFreq, rockstarVelocity);
        spotlight.Init(spotlightVelocity);
        meter.Init(seed, meterChangeFreq, meterMinVel, meterMaxVel, meterUpVel, 0f, 100f, meterGoodRange, 50f);
        rockstar.enabled  = false;
        spotlight.enabled = false;
        meter.enabled     = false;

        currMeterVel    = 0f;
        lastMeterLvl    = 50f;
        currRockstarVel = 0f;
    }
示例#2
0
 public void SpotlightTestsSetUp()
 {
     testObj           = new GameObject();
     testObj_spotlight = testObj.AddComponent <Spotlight>() as Spotlight;
     testObj_spotlight.Init(60f);
 }