public override void TASK_START() { base.startTask(); if (skip) { log.log("INFO skip task "+ name, 1); return; } if (!manager) { Start(); } if (!gui) { GameObject sgo = new GameObject("Item Display"); sgo.AddComponent <GUITexture>(); sgo.hideFlags = HideFlags.HideAndDontSave; sgo.transform.position = new Vector3(0, 0, 0); gui = sgo.GetComponent <GUITexture>(); //gui.pixelInset = new Rect( 20, Screen.height + 100, 500/4, 600/4); gui.pixelInset = new Rect((Screen.width - 500) / 2, 0, 500, 600); gui.transform.position = Vector3.zero; gui.transform.localScale = Vector3.zero; } current = items.currentString().Trim(); gui.texture = (Texture2D)Resources.Load("Items/" + current, typeof(Texture2D)); hud.setMessage("You delivered " + current); }
public override void TASK_START() { if (!manager) { Start(); } base.startTask(); current = questionList.currentString(); question = current; if (objects) { currentObject = objects.currentObject(); if (currentObject) { question = string.Format(question, currentObject.name); } } question = question.Replace(" ", "\n"); //workaround for multi line questions hud.setMessage(question); viewable = !viewable; compass.active = viewable; //arrow.active = viewable; // hud.showEverything(); TASK_ROTATE(null, new Vector3(270.0F, 0.0F, 0.0F)); log.log("INFO\tCOMPASS_START\t" + compassCount + "\t" + question + "\tAVATAR_LOCATION\tAVATAR_HEADING", 1); }
public override void startTask() { // Debug.Log(this.GetType().Name); base.startTask(); if (overideRepeat) { repeatCount = 1; repeat = Int32.Parse(overideRepeat.currentString().Trim()); } //Debug.Log("repeat: "); //Debug.Log( repeat); if (!skip) { startNextTask(); } }
public override void startTask() { // Debug.Log(this.GetType().Name); base.startTask(); if (overideRepeat) { repeatCount = 1; repeat = Int32.Parse(overideRepeat.currentString().Trim()); } //Debug.Log("repeat: "); //Debug.Log( repeat); //---------------------------------------------------------------------- // Automatically determine number of tasks based on children //---------------------------------------------------------------------- tasks = new GameObject[transform.childCount]; if (tasks.Length == 0) { skip = true; } else { for (int iTask = 0; iTask < tasks.Length; iTask++) { tasks[iTask] = transform.GetChild(iTask).gameObject; } } if (!skip) { startNextTask(); } }
public override void TASK_START() { if (!manager) { Start(); } base.startTask(); if (skip) { log.log("INFO skip task " + name, 1); return; } GameObject sgo = new GameObject("Instruction Display"); GameObject avatar = manager.player.GetComponent <HUD>().Canvas as GameObject; Text canvas = avatar.GetComponent <Text>(); hud.SecondsToShow = hud.InstructionDuration; sgo.AddComponent <GUIText>(); sgo.hideFlags = HideFlags.HideAndDontSave; sgo.transform.position = new Vector3(0, 0, 0); gui = sgo.GetComponent <GUIText>(); gui.pixelOffset = new Vector2(20, Screen.height - 20); gui.font = instructionFont; gui.fontSize = instructionSize; gui.material.color = text_color; gui.text = message.text; if (texts) { currentText = texts.currentString().Trim(); } if (objects) { currentObject = objects.currentObject(); } if (instruction) { canvas.text = instruction.text; } if (blackout) { hud.showOnlyHUD(); } if (message) { string msg = message.text; if (currentText != null) { msg = string.Format(msg, currentText); } if (currentObject != null) { msg = string.Format(msg, currentObject.name); } hud.setMessage(msg); } hud.flashStatus(""); if (restrictMovement) { manager.player.GetComponent <CharacterController>().enabled = false; manager.scaledPlayer.GetComponent <ThirdPersonCharacter>().immobilized = true; } // Change text and turn on the map action button if we're using it if (actionButtonOn) { // Use custom text for button (if provided) if (customButtonText != "") { actionButton.GetComponentInChildren <Text>().text = customButtonText; } // Otherwise, use default text attached to the button (component) else { actionButton.GetComponentInChildren <Text>().text = actionButton.GetComponent <DefaultText>().defaultText; } // activate the button hud.actionButton.SetActive(true); hud.actionButton.GetComponent <Button>().onClick.AddListener(hud.OnActionClick); // make the cursor functional and visible Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } //--------------------------- // Confidence Slider //--------------------------- sliderObject = hud.confidenceSlider.gameObject; sliderObject.SetActive(true); if (vrEnabled) { vrSlider = sliderObject.GetComponent <LM_vrSlider>(); } else { slider = sliderObject.GetComponent <Slider>(); } // Reset the value before the trial starts if (vrEnabled) { vrSlider.ResetSliderPosition(randomStartValue); } else { if (randomStartValue) { slider.value = Random.Range(slider.minValue, slider.maxValue); } else { slider.value = 0; } } }
public override void TASK_START() { repeatCount = 1; base.startTask(); if (skipCondition == manager.config.condition) { skip = true; } if (overideRepeat) { repeatCount = 1; repeat = Int32.Parse(overideRepeat.currentString().Trim()); } //---------------------------------------------------------------------- // Automatically determine number of tasks based on children //---------------------------------------------------------------------- tasks = new GameObject[transform.childCount]; if (tasks.Length == 0) { skip = true; } else { for (int iTask = 0; iTask < tasks.Length; iTask++) { tasks[iTask] = transform.GetChild(iTask).gameObject; } } //---------------------------------------------------------------------- // create list of random trials to flag as catch trials //---------------------------------------------------------------------- if (catchTrialCount > 0) { // Create a list of our trial numbers int[] catchCandidates; // if trial #1 can't be a catch trial if (noCatchOnFirstTrial) { catchCandidates = new int[repeat - 1]; for (int i = 0; i < repeat - 1; i++) { catchCandidates[i] = i + 2; // adjust because repeat count uses base-1 and to ignore trial 1 } } // Otherwise include all trials in our list else { catchCandidates = new int[repeat]; for (int i = 0; i < repeat; i++) { catchCandidates[i] = i + 1; // adjust because repeat count uses base-1 } } // Shuffle this list and use it to pick our catch trials Experiment.Shuffle(catchCandidates); // Pick our catch trials randomly from the shuffled trial order until // we have the specified number of catch trials catchTrials = new List <int>(); // must reset each time or we can get additive catch trials across blocks for (int i = 0; i < catchTrialCount; i++) { Debug.Log(i); Debug.Log(catchTrialCount); catchTrials.Add(catchCandidates[i]); } Debug.Log("HERE ARE OUR CATCH TRIALS (" + catchTrials.Count + ")"); foreach (int item in catchTrials) { Debug.Log(item); } } }
public override void TASK_START() { // if (!manager) Start(); Start(); base.startTask(); if (skip) { log.log("INFO skip task "+ name, 1); return; } // if (!gui) // { GameObject sgo = new GameObject("Instruction Display"); sgo.AddComponent <GUIText>(); sgo.hideFlags = HideFlags.HideAndDontSave; sgo.transform.position = new Vector3(0, 0, 0); gui = sgo.GetComponent <GUIText>(); // gui.pixelOffset = new Vector2( 100, Screen.height - 100); gui.pixelOffset = new Vector2(Screen.width / 6, Screen.height - (Screen.height / 6)); //gui.font = instructionFont; gui.fontSize = instructionSize; gui.material.color = text_color; // } if (texts) { currentText = texts.currentString().Trim(); } if (objects) { currentObject = objects.currentObject(); } if (instruction) { gui.text = instruction.text; } if (blackout) { hud.showOnlyHUD(); } if (message) { string msg = message.text; if (currentText != null) { msg = string.Format(msg, currentText); } if (currentObject != null) { msg = string.Format(msg, currentObject.name); } hud.setMessage(msg); } hud.flashStatus(""); }
public override void TASK_START() { if (!manager) { Start(); } base.startTask(); if (skip) { log.log("INFO skip task "+ name, 1); return; } // GameObject sgo = new GameObject("Instruction Display"); GameObject avatar = GameObject.Find("Canvas"); Text canvan = avatar.GetComponent("Canvas").GetComponent <Text>(); // sgo.AddComponent<GUIText>(); // sgo.hideFlags = HideFlags.HideAndDontSave; // sgo.transform.position = new Vector3(0,0,0); // gui = sgo.GetComponent<GUIText>(); // gui.pixelOffset = new Vector2( 20, Screen.height - 20); // //gui.font = instructionFont; // gui.fontSize = instructionSize; // gui.material.color = text_color; if (texts) { currentText = texts.currentString().Trim(); } if (objects) { currentObject = objects.currentObject(); } if (instruction) { canvan.text = instruction.text; } if (blackout) { hud.showOnlyHUD(); } if (message) { string msg = message.text; if (currentText != null) { msg = string.Format(msg, currentText); } if (currentObject != null) { msg = string.Format(msg, currentObject.name); } hud.setMessage(msg); } hud.flashStatus(""); }