Пример #1
0
    public void Setup(string _name = "")
    {
        if (!string.IsNullOrEmpty(_name))
        {
            mapName = _name;
        }

        editorOpen = false;
        prevState  = false;

        button = null;
        axis1D = null;
        axis2D = null;


        axisType = AxisType.Button;

        typeButton = InputTypeButton.ThumbClick;
        type1D     = InputTypeAxis1D.Trigger;
        type2D     = InputTypeAxis2D.Thumb2D;

        Activated   = new UnityEventVoid();
        Deactivated = new UnityEventVoid();

        UpdateBool = new UnityEventButton();
        Update1D   = new UnityEventFloat();

        Moved2D  = new UnityEventAxis2D();
        Moved2DX = new UnityEventFloat();
        Moved2DY = new UnityEventFloat();
    }
Пример #2
0
    public void Awake()
    {
        if (manager == null)
        {
            manager = GetComponentInParent <InputManager>();
        }

        if (manager && Application.isPlaying)
        {
            switch (axisType)
            {
            case AxisType.Button:
                button          = new VRButtonInput();
                button.keycode  = ButtonTranslation(manager.handedness);
                button.changed += ButtonUpdate;
                break;

            case AxisType.Axis1D:
                axis1D          = new VRAxis1DInput();
                axis1D.axisName = Axis1DTranslation(manager.handedness);
                axis1D.changed += Axis1DUpdate;
                break;

            case AxisType.Axis2D:
                axis2D           = new VRAxis2DInput();
                axis2D.axisNames = Axis2DTranslationVRTK(axis2D.axisNames, manager.handedness);
                axis2D.changed  += Axis2DUpdate;
                break;
            }
        }
        activationRange = new Vector2(.8f, 1);
    }