void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "leftHand" || other.gameObject.tag == "rightHand") { Debug.Log("Button Pressed!"); buttonSound.Play(); buttonSound.Play(44100); pressButtonAnimation.pressButton(); //Spawn Molecule if (!elementSpawned) { spawnQueueCount = spawnQueueCount + spawnNumberPerPress; elementSpawned = true; StartCoroutine("Countdown", respawnTime); } } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "leftHand" || other.gameObject.tag == "rightHand") { Debug.Log("Button Pressed!"); buttonSound.Play(); buttonSound.Play(44100); pressButtonAnimation.pressButton(); //Spawn Molecule if (!elementSpawned) { if (!textSpawned) { Instantiate(TextObj, transform.position + new Vector3(textBack, 0, textLeft), Quaternion.Euler(150, -90, -180)); textSpawned = true; } Instantiate(element, transform.position + Vector3.up * 6.0f, transform.rotation); elementSpawned = true; StartCoroutine("Countdown", respawnTime); } } }