public void RockstarTestsSetUp() { testObj = new GameObject(); testObj_rockstar = testObj.AddComponent <Rockstar>() as Rockstar; testObj_rockstar.rockstar = new GameObject().AddComponent <Animator>(); testObj_rockstar.Init("imaseed", 0f, 10f); }
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; }