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(); }
public void Awake() { if (manager == null) { manager = GetComponentInParent <InputManager>(); } if (manager && Application.isPlaying) { switch (axisType) { case AxisType.Button: button = gameObject.AddComponent <UnityButtonAction>(); button.KeyCode = ButtonTranslation(manager.handedness); button.ValueChanged.AddListener(ButtonUpdate); break; case AxisType.Axis1D: axis1D = gameObject.AddComponent <UnityAxis1DAction>(); axis1D.AxisName = Axis1DTranslation(manager.handedness); axis1D.ValueChanged.AddListener(Axis1DUpdate); break; case AxisType.Axis2D: axis2D = gameObject.AddComponent <UnityAxis2DAction>(); axis2D = Axis2DTranslationVRTK(axis2D, manager.handedness); axis2D.ValueChanged.AddListener(Axis2DUpdate); break; } } activationRange = new Vector2(.8f, 1); }