void Start() { // Script references m_ExpSetup = this.GetComponent <ExpSetup>(); m_ExpCueConj = this.GetComponent <ExpCueConj>(); photocell = GameObject.Find("Photocell"); }
public Vector3 SetDirection() { ExpMangerObject = GameObject.Find("ExperimentManager"); m_expCueConj = ExpMangerObject.GetComponent <ExpCueConj>(); // get target direction bool rightDirection = m_expCueConj.activeTarget.GetComponent <TargetMotion>().moveRight; // make list of possible x and y directions depending on target List <float> xDir = new List <float>(); List <float> yDir = new List <float>(); if (rightDirection) { xDir.Add(-1); xDir.Add(Mathf.Sqrt(2) / -2); yDir.Add(0); yDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(Mathf.Sqrt(2) / -2); // maybe xDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(Mathf.Sqrt(2) / -2); } else if (!rightDirection) { xDir.Add(1); xDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(0); yDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(Mathf.Sqrt(2) / -2); // maybe xDir.Add(Mathf.Sqrt(2) / -2); yDir.Add(Mathf.Sqrt(2) / 2); yDir.Add(Mathf.Sqrt(2) / -2); } // randomly select x and y directions int xIndex = Random.Range(0, xDir.Count); int yIndex = Random.Range(0, yDir.Count); float randX = xDir[xIndex]; float randY = yDir[yIndex]; //float randX = Random.Range(-1f, 1f); //float randY = Random.Range(-1f, 1f); direction = new Vector3(randX, randY, 0f); // calculate magnitude of motion vector magnitude = Mathf.Pow(randX, 2f) + Mathf.Pow(randY, 2); // x^2 + y^2 magnitude = Mathf.Sqrt(magnitude); // sqrt(x^2 + y^2) return(direction); }
void Start() { // Initialize variables expCueRef = GameObject.Find("ExperimentManager").GetComponent <ExpCueConj>(); // access the ExpCueConj.m script on ExperimentManager gameobject rightFlickerRef = rightFlickerObject.GetComponent <FlickerMaterial>(); // access the FlickerMaterial.m script on rightward gameobject leftFlickerRef = leftFlickerObject.GetComponent <FlickerMaterial>(); // access the FlickerMaterial.m script on leftward gameobject // Create filepath/filename for CSV file expPath = FileName(); //Debug.Log(expPath); // Write first line of CSV with variable labels corresponding to the following lines string newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", "Target Direction", "Target Shape", "Right Freq", "Left Freq", "Peripheral Direction", "Total Central Dots", "Number Targets", "Response", "Target Times"); csv.AppendLine(newLine); }
void Start() { // Setup script references m_ExpSetup = this.GetComponent <ExpSetup>(); m_ExpCueConj = this.GetComponent <ExpCueConj>(); m_ExpPeripheralConj = this.GetComponent <ExpPeripheralConj>(); m_ExpTrialConj = this.GetComponent <ExpTrialConj>(); m_TrialInfoDataConj = this.GetComponent <TrialInfoDataConj>(); m_FlickerManager = this.GetComponent <FlickerManager>(); // Setup peripheral display references occluderRef.AddRange(GameObject.FindGameObjectsWithTag("Occluder")); peripheralDisplayRef = GameObject.Find("Peripheral Display"); m_SpawnPeriperal = peripheralDisplayRef.GetComponent <SpawnPeripheral>(); // Setup fixation gameobject reference fixationObjectRef = GameObject.Find("FixationCross"); // Setup trial counter references trialCounterRef = GameObject.Find("TrialCounter"); m_TrialNumber = trialCounterRef.GetComponent <TrialNumber>(); trialCounterRef.SetActive(false); // hide trial counter // Setup input field references inputGameobjectRef = GameObject.Find("InputField"); inputGameobjectRef.SetActive(false); // hide text input field // Setup feedback references feedbackGameobjectRef = GameObject.Find("Feedback"); feedbackGameobjectRef.SetActive(false); // hide feedback object // Setup instruction references instructionsRef = GameObject.Find("Instructions"); // Setup coherence manager references coherenceManagerRef = GameObject.Find("CoherenceManager"); if (coherenceManagerRef != null) { m_AdjustCoherenceConj = coherenceManagerRef.GetComponent <AdjustCoherenceConj>(); } }
void Start() { m_ExpCueConj = this.GetComponent <ExpCueConj>(); }