/* * * public void CheckMyStatus() * { * // failsafe if the raycast moves too quickly off the bubble * if (raycastTimerThatHitMe == null) * { * BeingHit(false); * } * else * { * BeingHit(true); // i think!! * } * * } */ public void BeingHit(bool happens) { if (happens) { selected = true; // hitting if (parentSensor != null) // if it is a bubbleSensor { parentSensor.childBubbleIsGazedOn = true; parentSensor.BeingHit(true); } if (currentDwellWaitCoroutine != null) { StopCoroutine(currentDwellWaitCoroutine); } currentGazeWaitCoroutine = NewEvent(GazeWait, GazeEvent); if (BubbleSpawnPoint != null) // if a bubbleSensor is present, enable it { if (bubbleChildHolder == null) { CreateBubbleSelector(); } else { bubbleChildRenderer.enabled = true; bubbleChildCollider.enabled = true; } } StartCoroutine(currentGazeWaitCoroutine); if (!BubbleSpawnPoint) { currentDwellWaitCoroutine = NewEvent(useDwellWait, DwellEvent); StartCoroutine(currentDwellWaitCoroutine); } if (currentGazeOffWaitCoroutine != null) { StopCoroutine(currentGazeOffWaitCoroutine); } } else { // released selected = false; raycastTimerThatHitMe = null; if (parentSensor != null) { parentSensor.childBubbleIsGazedOn = false; // parentSensor.CheckMyStatus(); // need to do BeingHit instead! //rma2020_02_20 parentSensor.BeingHit(false); // I THINK! need to test this //rma2020_02_20 } if (bubbleChild != null) { bubbleChildRenderer.enabled = false; bubbleChildCollider.enabled = false; } currentGazeOffWaitCoroutine = NewEvent(GazeOffWait, GazeOffEvent); if (gameObject.activeInHierarchy) { StartCoroutine(currentGazeOffWaitCoroutine); } // can delete these? if (currentGazeWaitCoroutine != null) { StopCoroutine(currentGazeWaitCoroutine); } if (currentDwellWaitCoroutine != null) { StopCoroutine(currentDwellWaitCoroutine); } } }
public void RaycastFilterCheck(raycastTimer raycastTimerCheck) // 1st line of defense { if (starGameManagerRef != null) { if (!WorkInMenuNavMode && starGameManagerRef.controllerInteractionMode != ControllerInteractionMode.Teleport) { return; } } if (UseDistanceThreshold) { if (userTransform != null) { if (Vector3.Distance(gameObject.transform.position, userTransform.position) > DistanceThresholdOverride) { return; } } } bool canRegisterHit = true; if (InclusiveRayTag.Count != 0) { if (InclusiveRayTag.Contains(raycastTimerCheck.tag)) { canRegisterHit = true; } else { // not contained in inclusive list canRegisterHit = false; } } else { canRegisterHit = true; } if (ExclusiveRayTag.Count != 0) { if (ExclusiveRayTag.Contains(raycastTimerCheck.tag)) { canRegisterHit = false; } else { canRegisterHit = true; } } if (canRegisterHit) { raycastTimerThatHitMe = raycastTimerCheck; } else { raycastTimerThatHitMe = null; } }