public void CalculationDataSetupForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, IsOccludedByObstacleJobData IsOccludedByObstacleJobData, int currentObstacleIntersectionCalculatorCounter) { if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.ROUNDED_FRUSTUM) { var RoundedFrustumRangeObject = (RoundedFrustumRangeObjectV2)rangeIntersectionCalculator.GetAssociatedRangeObject(); var RoundedFrustumIntersectionJobData = new RoundedFrustumIntersectionJobData { RangeIntersectionCalculatorV2UniqueID = rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID, FrustumRadius = RoundedFrustumRangeObject.GetFrustum().GetFrustumFaceRadius(), RangeTransform = RoundedFrustumRangeObject.GetTransform(), IsOccludedByObstacleJobData = IsOccludedByObstacleJobData, RoundedFrustumPositions = RoundedFrustumRangeObject.GetFrustumWorldPositions(), ComparedCollider = rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderBoxDefinition(), ObstacleCalculationDataIndex = RoundedFrustumRangeObject.GetObstacleListener() == null ? -1 : (currentObstacleIntersectionCalculatorCounter - 1) }; this.RoundedFrustumIntersectionJobData[currentRoundedFrustumIntersectionJobDataCounter] = RoundedFrustumIntersectionJobData; currentRoundedFrustumIntersectionJobDataCounter += 1; } }
private bool IsInside(RoundedFrustumIntersectionJobData RoundedFrustumIntersectionJobData) { return(Intersection.BoxIntersectsOrEntirelyContainedInSphere(RoundedFrustumIntersectionJobData.ComparedCollider, RoundedFrustumIntersectionJobData.RangeTransform.WorldPosition, RoundedFrustumIntersectionJobData.FrustumRadius) && (Intersection.FrustumBoxIntersection(RoundedFrustumIntersectionJobData.RoundedFrustumPositions, RoundedFrustumIntersectionJobData.ComparedCollider) || Intersection.BoxEntirelyContainedInFrustum(RoundedFrustumIntersectionJobData.RoundedFrustumPositions, RoundedFrustumIntersectionJobData.ComparedCollider)) ); }
private bool IsInsideRoundedFrustum(Vector3 point, RoundedFrustumIntersectionJobData roundedFrustumIntersectionWithBoxJobData) { return((Vector3.Distance(point, roundedFrustumIntersectionWithBoxJobData.RangeTransform.WorldPosition) <= roundedFrustumIntersectionWithBoxJobData.FrustumRadius) && Intersection.PointInsideFrustum(roundedFrustumIntersectionWithBoxJobData.RoundedFrustumPositions, point)); }