コード例 #1
0
ファイル: FireBullet.cs プロジェクト: vvt3/Onslaught
    // 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;
        }
    }
コード例 #2
0
    // 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;
        }
    }