/* * When avatar come into contact with a TRIGGER * such as the destination cube. * @param col - the trigger that was collided */ void OnTriggerEnter(Collider col) { if (col.gameObject.CompareTag("target")) { infoBrg = new NextDirection(); //TheInformationBridge(); infoBrg.setEndTime(timerText.text); infoBrg.setNumOfCollisions(countColli); EasyTTSUtil.SpeechFlush("Congratulations, you've reached your destination."); Debug.Log("Game Over, you've completed the course"); Invoke("changeToEndGameScene", 4); // Wait 4 seconds and then call the "changeToEndScene" Method. } if (col.gameObject.tag == "Door") { Debug.Log("Walking through room " + col.gameObject.name + " door"); EasyTTSUtil.SpeechAdd("Walking through room " + col.gameObject.name + " door"); } }
/* * When avatar come into contact with a TRIGGER * such as the destination cube. * @param col - the trigger that was collided */ void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Door") { Debug.Log("Walking through room " + col.gameObject.name + " door"); EasyTTSUtil.SpeechAdd("Walking through room " + col.gameObject.name + " door"); } if (col.gameObject.CompareTag("target")) { endOfGame = true; nexDir = new NextDirection(); nexDir.setEndTime(timerText.text); nexDir.setNumOfCollisions(countColli); WriteString(); source.Stop(); EasyTTSUtil.SpeechAdd("Congratulations, you've reached your destination."); Debug.Log("Game Over, you've completed the course"); isAllowMove = false; isReachTarget = true; infoBrg.setReachTarget(isReachTarget); StartCoroutine(MyCoroutine(5)); //Application.Quit(); /****************************************** not for test * //Invoke("EndGame", 4); // Wait 4 seconds and then call the "changeToEndScene" Method. * * /////// Get UnityPlayerActivity class from Android Side //////////////// * using (AndroidJavaClass jc = new AndroidJavaClass("com.jastworld.interfaceplugin.UnityPlayerActivity")) * { * if (jc != null) * { * //jc.CallStatic("UnitySendMessage", "text", "setText", "Got UnityPlayerActivity Class!"); * //print("Got UnityPlayerActivity Class!"); * * /////// Get the instance of UnityPlayerActivity class from Android Side //////////////// * using (AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity")) * { * if (jo != null) * { * //jc.CallStatic("UnitySendMessage", "text", "setText", "Got UnityPlayerActivity Object!"); * //print("Got UnityPlayerActivity Object!"); * * //////// Call goToEnd() method in the instance of UnityPlayerActivity ///////// * jo.Call("EndScreen", timerText.text, (countColli+"")); * //jo.Call("goToEnd"); * } * else * { * //jc.CallStatic("UnitySendMessage", "text", "setText", "NOT Got UnityPlayerActivity Object!"); * print("NOT Got UnityPlayerActivity Object!"); * } * } * } * else * { * jc.CallStatic("UnitySendMessage", "text", "setText", "NOT Got UnityPlayerActivity Class!"); * print("NOT Got UnityPlayerActivity Class!"); * } * * }**********************************************/ } }