public override void Update(float deltaTime) { base.Update(deltaTime); if (StartButton.clicked == true) { // Sets the output file name as the desired one. var Field1Text = _fields[0].transform.GetComponentsInChildren <Text>()[1]; TrialProgress.Field1 = Field1Text.text; var Field2Text = _fields[1].transform.GetComponentsInChildren <Text>()[1]; TrialProgress.Field2 = Field2Text.text; var Field3Text = _fields[2].transform.GetComponentsInChildren <Text>()[1]; TrialProgress.Field3 = Field3Text.text; var Field4Text = _fields[3].transform.GetComponentsInChildren <Text>()[1]; TrialProgress.Field4 = Field4Text.text; DS.GetData().OutputFile = TrialProgress.Field1 + "_" + TrialProgress.Field2 + "_" + TrialProgress.Field3 + "_" + TrialProgress.Field4 + "_" + DateTime.Now.ToString("yyyy-MM-dd-HH.mm.ss") + ".csv"; GenerateTrials(); Loader.LogHeaders(); Progress(); } }
private void Update() { currBlockId = E.Get().CurrTrial.BlockID; currTrialId = E.Get().CurrTrial.TrialID; //HUD for the number of successful trials in the current Block if (DS.GetData().Blocks[currBlockId].ShowNumSuccesses | DS.GetData().Trials[currTrialId].ShowNumSuccesses) { var trialsuccessText = GameObject.Find("TrailSuccesses").GetComponent <Text>(); trialsuccessText.text = "Successful Trials: " + E.Get().CurrTrial.TrialProgress.NumSuccess; } //HUD for the number of goals found in the current trial if (DS.GetData().Blocks[currBlockId].ShowTrialTotal | DS.GetData().Trials[currTrialId].ShowTrialTotal) { var trialtotalText = GameObject.Find("TrialTotal").GetComponent <Text>(); trialtotalText.text = "Goals Found In Trial: " + E.Get().CurrTrial.NumCollected; } //HUD for the number of goals found in the current Block if (DS.GetData().Trials[currTrialId].ShowBlockTotal | DS.GetData().Blocks[currBlockId].ShowBlockTotal) { var blocktotalText = GameObject.Find("BlockTotal").GetComponent <Text>(); blocktotalText.text = "Goals Found In Block: " + E.Get().CurrTrial.TrialProgress.NumCollectedPerBlock[currBlockId]; } }
// Update is called once per frame private void Update() { //This calculates the current amount of rotation frame rate independent var rotation = Input.GetAxis("Horizontal") * DS.GetData().CharacterData.RotationSpeed *Time.deltaTime; //This calculates the forward speed frame rate independent var moveDirection = new Vector3(0, Input.GetAxis("Vertical"), 0); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= DS.GetData().CharacterData.MovementSpeed; //Here is the movement system const double tolerance = 0.0001; //we move iff rotation is 0 if (Math.Abs(Mathf.Abs(rotation)) < tolerance) { GetComponent <CharacterController>().Move(moveDirection * Time.deltaTime); } transform.Rotate(0, 0, -rotation); }
//We are gonna generate all the trials here. private void GenerateTrials() { AbstractTrial currentTrial = this; foreach (var i in DS.GetData().BlockOrder) { var l = i - 1; var block = DS.GetData().Blocks[l]; var newBlock = true; AbstractTrial currHead = null; var tCnt = 0; foreach (var j in block.TrialOrder) { var k = j - 1; AbstractTrial t; // Here we decide what each trial is, I guess we could do this with a function map, but later. // here we have a picture as a trial. if (k < 0) { t = new RandomTrial(l, k); } else { var trialData = DS.GetData().Trials[k]; // Control flow here is for deciding what Trial gets spat out from the config if (trialData.FileLocation != null) { Debug.Log("Creating new Instructional Trial"); t = new InstructionalTrial(l, k); } else if (trialData.TwoDimensional == 1) { Debug.Log("Creating new 2D Screen Trial"); t = new TwoDTrial(l, k); } else { Debug.Log("Creating new 3D Screen Trial"); t = new ThreeDTrial(l, k); } } if (newBlock) { currHead = t; } t.isTail = tCnt == block.TrialOrder.Count - 1; t.head = currHead; currentTrial.next = t; currentTrial = currentTrial.next; newBlock = false; tCnt++; } currentTrial.next = new CloseTrial(-1, -1); } }
// Update is called once per frame private void Update() { // ...also rotate around the World's Y axis transform.Rotate(0, 0.1f * Time.deltaTime * DS.GetData().CharacterData.GoalRotationSpeed, 0, Space.World); }