// Update is called once per frame void Update() { if (m_Timer > 0) { m_Timer -= Time.deltaTime; } if (m_Timer <= 0 && isFiring) { if (m_NumSpecialAmmo > 0 && specialBulletPrefab != null) { GameObject bullet = Instantiate(specialBulletPrefab, m_Transform.position, m_Transform.rotation); bullet.transform.localScale = GameManager.instance.gameScale; if (m_audioSource != null) { m_audioSource.PlayOneShot(specialAmmoFireClip); } HapticAbstraction.BuzzBothHands(hapticTime); m_NumSpecialAmmo--; } else if (bulletPrefab != null) { GameObject bullet = Instantiate(bulletPrefab, m_Transform.position, m_Transform.rotation); bullet.transform.localScale = GameManager.instance.gameScale; if (m_audioSource != null) { m_audioSource.Play(); } HapticAbstraction.BuzzBothHands(hapticTime); } m_Timer = cooldown; } }
// Update is called once per frame void Update() { if (m_Timer > 0) { m_Timer -= Time.deltaTime; } if (m_Timer <= 0 && InputAbstraction.FireControlActive(InputAbstraction.PreferedHand())) { if (m_NumSpecialAmmo > 0 && specialBulletPrefab != null) { Instantiate(specialBulletPrefab, m_Transform.position, m_Transform.rotation); if (m_audioSource != null) { m_audioSource.PlayOneShot(specialAmmoFireClip); } HapticAbstraction.BuzzBothHands(hapticTime); m_NumSpecialAmmo--; } else if (bulletPrefab != null) { Instantiate(bulletPrefab, m_Transform.position, m_Transform.rotation); if (m_audioSource != null) { m_audioSource.Play(); } HapticAbstraction.BuzzBothHands(hapticTime); } m_Timer = cooldown; } }
IEnumerator PlayFor() { s += 0.02f; if (s < 1) { HapticAbstraction.BuzzNode(1000f, UnityEngine.XR.XRNode.RightHand); } yield return(new WaitForSeconds(0.1f)); }
private void OnTriggerEnter(Collider other) { if (isRightHand) { HapticAbstraction.BuzzNode(5f, UnityEngine.XR.XRNode.RightHand); // StartCoroutine(PlayFor()); } else { HapticAbstraction.BuzzNode(5f, UnityEngine.XR.XRNode.LeftHand); } Debug.Log("buzzing"); }