void Start() { LeftControllerEvents = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(LeftController); RightControllerEvents = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(RightController); if (LeftControllerEvents == null || RightController == null) { Debug.LogError("Missing ControllerEvents!"); return; } _leftTooltipAdapter = LeftController.GetComponent <TooltipTransformAdapterBase>(); _rightTooltipAdapter = RightController.GetComponent <TooltipTransformAdapterBase>(); if (_leftTooltipAdapter == null || _rightTooltipAdapter == null) { Debug.LogError("Missing TooltipTransformAdapterBase!"); return; } _leftTooltipAdapter.Init(TooltipControllers.Left); _rightTooltipAdapter.Init(TooltipControllers.Right); StartCoroutine(ControllerEventsSubscriptionSafe()); _tooltipObjectsLeft = new Dictionary <TooltipButtons, GameObject>(); _tooltipObjectsRight = new Dictionary <TooltipButtons, GameObject>(); }
private void Start() { _uiMenu = FindObjectOfType <UIMenu>(); _controllerEvents = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(gameObject); _controllerEvents.TriggerPressed += DoTriggerRightPressed; _controllerEvents.TouchpadReleased += TouchpadReleased; _controllerEvents.TouchpadPressed += TouchPadPressed; _controllerEvents.ButtonTwoPressed += StartMenuPressed; _controllerEvents.ButtonTwoReleased += StartMenuLeftReleased; _controllerEvents.GripPressed += ControllerEventsOnGripPressed; _toolTip = Instantiate(GameObjects.Instance.UIToolTip); _toolTip.SetActive(false); StartCoroutine(SubscribeForMenuEventsCoroutine()); ProjectData.GameModeChanged += ManagePointerRayGameModeChanged; InputTracking.trackingLost += OnTrackingChange; InputTracking.trackingAcquired += OnTrackingChange; }
private void OnAnyGrabStart(object sender, ObjectInteraction.InteractableObjectEventArgs e) { if (!_isRoot) { return; } CollisionController collisionController = _gameObject.GetComponent <CollisionController>(); if (collisionController == null || !collisionController.enabled) { _gameObject.AddComponent <CollisionController>().InitializeController(this); } //all I can say is OOF; no regrets var hc = InputAdapter.Instance.PlayerController.Nodes.GetControllerReference(e.Hand); hc.Controller.AddColliders(hc.Controller.GetGrabbedObject().GetComponentsInChildren <Collider>()); ControllerEvents = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(_vio.GetGrabbingObject()); }