示例#1
0
        public virtual float GetValue(InputManagerBase manager)
        {
            float value = 0.0f;

            foreach (var virtualButton in Items)
            {
                float newValue = virtualButton != null?virtualButton.GetValue(manager) : 0.0f;

                // In case of a || (disjunction) set, we return the latest non-zero value.
                if (IsDisjunction)
                {
                    if (newValue != 0.0f)
                    {
                        value = newValue;
                    }
                }
                else
                {
                    // In case of a && (conjunction) set, we return the last non-zero value unless there is a zero value.
                    if (newValue == 0.0f)
                    {
                        return(0.0f);
                    }

                    value = newValue;
                }
            }
            return(value);
        }
示例#2
0
        public virtual float GetValue(InputManagerBase inputManager, object name)
        {
            float value = 0.0f;
            List <VirtualButtonBinding> bindingsPerName;

            if (mapBindings.TryGetValue(name, out bindingsPerName))
            {
                foreach (var virtualButtonBinding in bindingsPerName)
                {
                    float newValue = virtualButtonBinding.GetValue(inputManager);
                    if (Math.Abs(newValue) > Math.Abs(value))
                    {
                        value = newValue;
                    }
                }
            }

            return(value);
        }
示例#3
0
 public abstract float GetValue(InputManagerBase manager);