Ejemplo n.º 1
0
    private unsafe float ScoreFunc(string compositeType, InputControl control, InputEventPtr eventPtr)
    {
        var statePtr  = control.GetStatePtrFromStateEvent(eventPtr);
        var magnitude = control.EvaluateMagnitude(statePtr);

        if (control.synthetic)
        {
            return(magnitude - 1);
        }

        // Give preference to controls which match the expected type (ie get the Vector2 for a Stick,
        // rather than individual axes), but allow other types to let us construct the control as a
        // composite.
        if (ControlMatchesCompositeType(control, m_CompositeType))
        {
            return(magnitude + 1);
        }

        return(magnitude);
    }