/// <summary> /// When the Raycaster stops detecting an object this subscriber desires, we'll have to react to that change. /// </summary> public void OnRaycastExit() { // Call the logic syncronously for this subscriber. this.RaycastEnded(); // Unsubscribe from further exit events. this.lastCallingRaycaster.OnRaycastEnded -= this.OnRaycastExit; this.lastCallingRaycaster = null; this.focusedGameObject = null; }
/// <summary> /// When the Raycaster starts detecting an object this subscriber desires, we'll have to react to that change, and ready for the exit. /// </summary> public void OnRaycastEnter(RaycastBeginPayload enterPayload) { // Subscribe to the exit event on this subscriber. this.lastCallingRaycaster = enterPayload.CallingObject; this.lastCallingRaycaster.OnRaycastEnded += this.OnRaycastExit; this.focusedGameObject = enterPayload.FocusedObject; // Call the logic asynronously for this subscriber. this.RaycastStarted(); }