Exemple #1
0
    void CycleWeapons()
    {
        if (m_currentWeaponTime < m_weaponChangeTime)
        {
            m_currentWeaponTime += Time.deltaTime;
        }

        if (m_currentWeaponTime >= m_weaponChangeTime)
        {
            int type = -1;
            type = UnityEngine.Random.Range(0, (int)WeaponMgr.WeaponType.WEAPON_COUNT);
            if (type == (int)WeaponMgr.ACTIVE_WEAPON_TYPE)
            {
                if (type > 0)
                {
                    type -= 1;
                }
                else
                {
                    type += 1;
                }
            }

            //Debug.Log("Weapon taaaaaaip: " + type);
            WeaponMgr.ChangeWeapon((WeaponMgr.WeaponType)type);

            // re-init weapon bs
            m_currentWeaponTime = 0;
            m_weaponChangeTime  = UnityEngine.Random.Range(minRange, maxRange);
            //Debug.Log("Weapon cycle time: " + m_weaponChangeTime);
        }
    }
Exemple #2
0
    void ListenToWeaponCycle()
    {
        WeaponMgr.WeaponType type = WeaponMgr.ACTIVE_WEAPON.GetWeaponType();

        if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.LeftShoulder))
        {
            Debug.Log("CYCLE LEFT WPN");
            // cycle weapon left
            if (type > 0)
            {
                WeaponMgr.ChangeWeapon(type - 1);
            }
        }
        else if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.RightShoulder))
        {
            Debug.Log("CYCLE RIGHT WPN");
            // cycle weapon right
            if (type < (WeaponMgr.WeaponType.WEAPON_COUNT - 1))
            {
                WeaponMgr.ChangeWeapon(type + 1);
            }
        }
    }