// Update is called once per frame void OnTriggerEnter(Collider other) { if (other.name == tagToTriggerDialog) { // bring up the window GameObject thePlayer = GameObject.Find("Player"); Debug.Log("player at " + thePlayer.transform.position); PlayerAttributes pa = (PlayerAttributes)thePlayer.GetComponent("PlayerAttributes"); Debug.Log("dialogBox location " + pa.textBoxLocation.transform.position); Debug.Log("dialogBox location " + pa.textBoxLocation.transform.localPosition); dialogBox.transform.position = pa.textBoxLocation.transform.position; //dialogBox.transform.position = pa.textBoxLocation.transform.position; TextBoxControl tbc = (TextBoxControl)dialogBox.GetComponent("TextBoxControl"); tbc.ActivateWindow(); // pause the game Time.timeScale = 0.0001f; // destroy if necessary if (destroyTriggerAfterReading) { Destroy(gameObject); } } }
// Update is called once per frame void Update() { if (windowIsActive) { if (Input.GetAxis("Fire1") > 0.0f || Input.GetAxis("Jump") > 0.0f) { if (nextScreen != null) { nextScreen.transform.position = transform.position; transform.position = originalPosition; windowIsActive = false; TextBoxControl tbc = (TextBoxControl)nextScreen.GetComponent("TextBoxControl"); tbc.ActivateWindow(); } else { Time.timeScale = 1.0f; transform.position = originalPosition; windowIsActive = false; } } } }