コード例 #1
0
ファイル: InputAction.cs プロジェクト: yebata/InputSystem
            public AddBindingSyntax CombinedWith(string binding, string modifiers = null, string group = null)
            {
                if (action.m_BindingsCount - 1 != m_BindingIndex)
                {
                    throw new InvalidOperationException("Must not add other bindings in-between calling AddBindings() and CombinedWith()");
                }

                var result = action.AddBinding(binding, modifiers: modifiers, groups: group);

                action.m_Bindings[action.m_BindingsStartIndex + result.m_BindingIndex].flags |=
                    InputBinding.Flags.ThisAndPreviousCombine;

                return(result);
            }
コード例 #2
0
        public InputAction AddAction(string name, string binding = null, string modifiers = null, string groups = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Action must have name", "name");
            }
            if (TryGetAction(name) != null)
            {
                throw new InvalidOperationException(
                          string.Format("Cannot add action with duplicate name '{0}' to set '{1}'", name, this.name));
            }

            var action = new InputAction(name);

            ArrayHelpers.Append(ref m_Actions, action);
            action.m_ActionSet = this;

            if (!string.IsNullOrEmpty(binding))
            {
                action.AddBinding(binding, modifiers: modifiers, groups: groups);
            }

            return(action);
        }