///////////////////////////////////////////////////////////////// // COLLIDER METHODS ///////////////////////////////////////////////////////////////// void OnTriggerEnter(Collider other) { SceneObject si = other.gameObject. GetComponent<SceneObject>() as SceneObject; if (si != null) { touch = si; touch.Highlight(); } CalibrateBox cb = other.gameObject. GetComponent<CalibrateBox>() as CalibrateBox; if (cb != null) { calibrateBox = cb; calibrateBox.Highlight(); } TouchMe tm = other.gameObject. GetComponent<TouchMe>() as TouchMe; if (tm != null) { if (trial != null) { trial.TouchMe(); } if (practice != null) { practice.TouchMe(); } } }
void OnTriggerExit(Collider other) { if (touch != null) { touch.Unhighlight(); touch = null; } if (calibrateBox != null) { calibrateBox.Unhighlight(); calibrateBox = null; } }
public void LoadCalibrationBox() { if (calibrateBox != null) { Destroy(calibrateBox.gameObject); } if (touchMe != null) { Destroy(touchMe.gameObject); } // Create sceneObject string cbPath = "Prefabs/CalibrateBox"; GameObject go = Instantiate(Resources.Load(cbPath), Vector3.zero, Quaternion.identity) as GameObject; calibrateBox = go.GetComponent<CalibrateBox>() as CalibrateBox; if (calibrateBox != null) { // Give it a random position and orientation. calibrateBox.transform.position = new Vector3(0f, 12.5f, 12.5f); calibrateBox.transform.rotation = Quaternion.identity; } calibrateBox.PracticeNum(practiceNum); }