/// <summary>
        /// Activate this set so its actions can be called
        /// </summary>
        /// <param name="disableAllOtherActionSets">Disable all other action sets at the same time</param>
        /// <param name="priority">The priority of this action set. If you have two actions bound to the same input (button) the higher priority set will override the lower priority. If they are the same priority both will execute.</param>
        /// <param name="activateForSource">Will activate this action set only for the specified source. Any if you want to activate for everything</param>
        public void Activate(SteamVR_Input_Sources activateForSource = SteamVR_Input_Sources.Any, int priority = 0, bool disableAllOtherActionSets = false)
        {
            int sourceIndex = (int)activateForSource;

            if (disableAllOtherActionSets)
            {
                SteamVR_ActionSet_Manager.DisableAllActionSets();
            }

            if (rawSetActive[sourceIndex] == false)
            {
                rawSetActive[sourceIndex] = true;
                SteamVR_ActionSet_Manager.SetChanged();

                rawSetLastChanged[sourceIndex] = Time.realtimeSinceStartup;
            }

            if (rawSetPriority[sourceIndex] != priority)
            {
                rawSetPriority[sourceIndex] = priority;
                SteamVR_ActionSet_Manager.SetChanged();

                rawSetLastChanged[sourceIndex] = Time.realtimeSinceStartup;
            }
        }
Exemple #2
0
        /// <summary>
        /// Deactivate the action set so its actions can no longer be called
        /// </summary>
        public void Deactivate(SteamVR_Input_Sources forSource = SteamVR_Input_Sources.Any)
        {
            if (rawSetActive[forSource] != false)
            {
                rawSetLastChanged[forSource] = Time.realtimeSinceStartup;
                SteamVR_ActionSet_Manager.SetChanged();
            }

            rawSetActive[forSource]   = false;
            rawSetPriority[forSource] = 0;
        }