// Update is called once per frame void Update() { //Debug.Log(userModeManagerScript.isLearnMode()); if (userModeManagerScript.isLearnMode()) { if (markedItemsScript.isCurrentLearningItem(gameObject)) { if (!playing) { pronounceItem(); playing = true; } } } else { if (playing) { itemAudioSource.Stop(); playing = false; } } timeSincePlayed += Time.deltaTime; }
// Update is called once per frame void Update() { // Do a raycast into the world based on the user's // head position and orientation. var headPosition = Camera.main.transform.position; var gazeDirection = Camera.main.transform.forward; RaycastHit hitInfo; if (Physics.Raycast(headPosition, gazeDirection, out hitInfo)) { // If the raycast hit a hologram... // Display the cursor mesh. meshRenderer.enabled = true; // Move the cursor to the point where the raycast hit. this.transform.position = hitInfo.point; // Rotate the cursor to hug the surface of the hologram. this.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal); if (userModeManagerScript.isLearnMode()) { GameObject collidedItem = hitInfo.collider.gameObject; if (markedItemsScript.isCurrentLearningItem(collidedItem)) { RemoveMarker(collidedItem); } else if (markedItemsScript.isInLearningItems(collidedItem)) { playAlert(); } } } else { // If the raycast did not hit a hologram, hide the cursor mesh. meshRenderer.enabled = false; } timeSincePlayed += Time.deltaTime; }
public void PlaySound(string soundType) { if (timeSincePlayed < 2.0f) { return; } // Do play sound here... if (soundType == "item") { //Debug.Log(userModeManagerScript.isLearnMode()); if (userModeManagerScript.isLearnMode()) { if (markedItemsScript.isCurrentLearningItem(gameObject)) { if (!playing) { pronounceItem(); playing = true; } } } else { //if (playing) //{ //itemAudioSource.Stop(); playing = false; //} } timeSincePlayed += Time.deltaTime; } timeSincePlayed = 0.0f; }