public void CountingForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator) { if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.SPHERE) { this.totalSphereTypeIntersection += 1; } }
public bool ForRangeInteresectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, ObstacleOcclusionCalculationManagerV2 ObstacleOcclusionCalculationManagerV2, out IsOccludedByObstacleJobData IsOccludedByObstacleJobData) { int ObstacleFrustumPointsPositionsBeginIndex = currentObstacleFrustumPointsCounter; var associatedObstacleListener = rangeIntersectionCalculator.GetAssociatedObstacleListener(); if (associatedObstacleListener != null) { //obstacle listener may never have triggered calculation ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(associatedObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions); if (calculatedFrustumPositions != null) { foreach (var calculatedObstacleFrustumList in calculatedFrustumPositions.Values) { foreach (var calculatedObstacleFrustum in calculatedObstacleFrustumList) { this.AssociatedObstacleFrustumPointsPositions[currentObstacleFrustumPointsCounter] = calculatedObstacleFrustum; currentObstacleFrustumPointsCounter += 1; } } } IsOccludedByObstacleJobData = new IsOccludedByObstacleJobData { TestedBoxCollider = new BoxDefinition(rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderAsBox()), ObstacleFrustumPointsPositionsBeginIndex = ObstacleFrustumPointsPositionsBeginIndex, ObstacleFrustumPointsPositionsEndIndex = currentObstacleFrustumPointsCounter }; return(true); } IsOccludedByObstacleJobData = default; return(false); }
public void CountingForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator) { if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.ROUNDED_FRUSTUM) { this.totalRoundedFrustumTypeIntersection += 1; } }
/// <summary> /// Build the <see cref="VisibilityProbeIntersectionJobData"/> and feed the <see cref="VisibilityProbeLocalPoints"/> based on targetted interactive object probe. /// </summary> private VisibilityProbeIntersectionJobData CalculatingVisibilityProbeJobData(RangeIntersectionCalculator RangeIntersectionCalculatorV2, ref int currentVisibilityProbeLocalPointsCounter) { var visibilityProbes = RangeIntersectionCalculatorV2.TrackedInteractiveObject.InteractiveGameObject.VisibilityProbe; VisibilityProbeIntersectionJobData visibilityProbeIntersectionJobData = default; if (visibilityProbes.LocalPoints != null && visibilityProbes.LocalPoints.Length > 0) { int startIndex = currentVisibilityProbeLocalPointsCounter; int endIndex = startIndex; for (int i = 0; i < visibilityProbes.LocalPoints.Length; i++) { this.VisibilityProbeLocalPoints[currentVisibilityProbeLocalPointsCounter] = visibilityProbes[i]; endIndex = currentVisibilityProbeLocalPointsCounter; currentVisibilityProbeLocalPointsCounter += 1; } visibilityProbeIntersectionJobData = new VisibilityProbeIntersectionJobData() { VisibilityProbeLocalToWorld = RangeIntersectionCalculatorV2.TrackedInteractiveObject.InteractiveGameObject.LogicCollider.transform.localToWorldMatrix, VisibilityProbePositionsBeginIndexIncluded = startIndex, VisibilityProbePositionsEndIndexIncluded = endIndex }; } return(visibilityProbeIntersectionJobData); }
protected override void OnJustNotIntersected(RangeIntersectionCalculator intersectionCalculator) { if (OnJustNotIntersectedAction != null) { OnJustNotIntersectedAction.Invoke(intersectionCalculator.TrackedInteractiveObject); } }
protected override void OnInterestedNothing(RangeIntersectionCalculator intersectionCalculator) { if (OnInterestedNothingAction != null) { OnInterestedNothingAction.Invoke(intersectionCalculator.TrackedInteractiveObject); } }
public int OnRangeIntersectionCalculatorV2ManagerCreation(RangeIntersectionCalculator rangeIntersectionCalculator) { this.AllRangeIntersectionCalculatorV2.Add(rangeIntersectionCalculator); this.CurrentRangeIntersectionCalculatorV2ManagerCounter += 1; rangeIntersectionCalculator.GetAssociatedRangeObject().RegisterOnRangeObjectDestroyedEventListener(this.OnRangeObjectDestroyed); rangeIntersectionCalculator.TrackedInteractiveObject.RegisterInteractiveObjectDestroyedEventListener(this.OnTrackedInteractiveObjectDestroyed); return(this.CurrentRangeIntersectionCalculatorV2ManagerCounter); }
private void SingleJustExited(RangeIntersectionCalculator justTriggerExitedRangeIntersectionCalculator) { //Debug.Log("JustTriggeredExit : " + justTriggerExitedCalculatorIndex + " " + this.justTriggerExitedCalculators.Count); OnJustNotIntersected(justTriggerExitedRangeIntersectionCalculator); justTriggerExitedRangeIntersectionCalculator.OnDestroy(); justTriggerExitedCalculatorsIndexedByTrackedInteractiveObject.Remove(justTriggerExitedRangeIntersectionCalculator.TrackedInteractiveObject); justTriggerExitedCalculators.Remove(justTriggerExitedRangeIntersectionCalculator); }
public sealed override void OnTriggerEnter(RangeObjectPhysicsTriggerInfo PhysicsTriggerInfo) { var rangeIntersectionCalculator = new RangeIntersectionCalculator(associatedRangeObject, PhysicsTriggerInfo.OtherInteractiveObject); intersectionCalculators.Add(rangeIntersectionCalculator); intersectionCalculatorsIndexedByTrackedInteractiveObject[PhysicsTriggerInfo.OtherInteractiveObject] = rangeIntersectionCalculator; OnTriggerEnterSuccess(PhysicsTriggerInfo); }
public sealed override void OnTriggerEnter(InteractiveObjectPhysicsTriggerInfo PhysicsTriggerInfo) { PhysicsTriggerInfo.OtherInteractiveObject.RegisterInteractiveObjectDestroyedEventListener(this.OnInteractiveObjectDestroyed); var rangeIntersectionCalculator = new RangeIntersectionCalculator(associatedRangeObject, PhysicsTriggerInfo.OtherInteractiveObject); intersectionCalculators.Add(rangeIntersectionCalculator); intersectionCalculatorsIndexedByTrackedInteractiveObject[PhysicsTriggerInfo.OtherInteractiveObject] = rangeIntersectionCalculator; OnTriggerEnterSuccess(PhysicsTriggerInfo); }
private void SingleCalculation(RangeIntersectionCalculator intersectionCalculator) { var intersectionOperation = intersectionCalculator.Tick(); if (intersectionOperation == InterserctionOperationType.JustInteresected) { OnJustIntersected(intersectionCalculator); } else if (intersectionOperation == InterserctionOperationType.JustNotInteresected) { OnJustNotIntersected(intersectionCalculator); } else if (intersectionOperation == InterserctionOperationType.IntersectedNothing) { OnInterestedNothing(intersectionCalculator); } }
public void CalculationDataSetupForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, IsOccludedByObstacleJobData IsOccludedByObstacleJobData, int currentObstacleIntersectionCalculatorCounter) { if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.SPHERE) { var SphereRangeObject = (SphereRangeObjectV2)rangeIntersectionCalculator.GetAssociatedRangeObject(); var SphereIntersectionJobData = new SphereIntersectionJobData { RangeIntersectionCalculatorV2UniqueID = rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID, RangeTransform = SphereRangeObject.GetTransform(), IsOccludedByObstacleJobData = IsOccludedByObstacleJobData, ComparedCollider = rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderBoxDefinition(), ObstacleCalculationDataIndex = SphereRangeObject.GetObstacleListener() == null ? -1 : (currentObstacleIntersectionCalculatorCounter - 1), SphereRadius = SphereRangeObject.SphereBoundingCollider.radius }; this.SphereIntersectionJobData[this.currentSphereIntersectionJobdataCounter] = SphereIntersectionJobData; this.currentSphereIntersectionJobdataCounter += 1; } }
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; } }
// Try to get all occlusion frustums fro mthe obstacle listener and push them in the AssociatedObstacleFrustumPointsPositions. // Returns the index range of insertion of AssociatedObstacleFrustumPointsPositions. public bool ForRangeInteresectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, ObstacleOcclusionCalculationManagerV2 ObstacleOcclusionCalculationManagerV2, out IsOccludedByObstacleJobData IsOccludedByObstacleJobData) { int ObstacleFrustumPointsPositionsBeginIndex = currentObstacleFrustumPointsCounter; var associatedObstacleListener = rangeIntersectionCalculator.GetAssociatedObstacleListener(); if (associatedObstacleListener != null) { //obstacle listener may never have triggered calculation ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(associatedObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions); if (calculatedFrustumPositions != null) { var calculatedFrustumPositionsEnumerator = calculatedFrustumPositions.Values.GetEnumerator(); while (calculatedFrustumPositionsEnumerator.MoveNext()) { var calculatedObstacleFrustumList = calculatedFrustumPositionsEnumerator.Current; for (int calculatedObstacleFrustumIndex = 0; calculatedObstacleFrustumIndex < calculatedObstacleFrustumList.Count; calculatedObstacleFrustumIndex++) { this.AssociatedObstacleFrustumPointsPositions[currentObstacleFrustumPointsCounter] = calculatedObstacleFrustumList[calculatedObstacleFrustumIndex]; currentObstacleFrustumPointsCounter += 1; } } } IsOccludedByObstacleJobData = new IsOccludedByObstacleJobData { ObstacleFrustumPointsPositionsBeginIndex = ObstacleFrustumPointsPositionsBeginIndex, ObstacleFrustumPointsPositionsEndIndex = currentObstacleFrustumPointsCounter }; return(true); } IsOccludedByObstacleJobData = default; return(false); }
public void TryGetRangeintersectionResult(RangeIntersectionCalculator rangeIntersectionCalculator, out bool result) { GetRangeIntersectionResult().TryGetValue(rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID, out result); }
public bool GetRangeIntersectionResult(RangeIntersectionCalculator rangeIntersectionCalculator) { return(GetRangeIntersectionResult()[rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID]); }
public void OnRangeIntersectionCalculatorV2ManagerDestroyed(RangeIntersectionCalculator rangeIntersectionCalculator) { this.AllRangeIntersectionCalculatorV2.Remove(rangeIntersectionCalculator); }
protected virtual void OnJustNotIntersected(RangeIntersectionCalculator intersectionCalculator) { }
public int OnRangeIntersectionCalculatorV2ManagerCreation(RangeIntersectionCalculator rangeIntersectionCalculator) { this.AllRangeIntersectionCalculatorV2.Add(rangeIntersectionCalculator); this.CurrentRangeIntersectionCalculatorV2ManagerCounter += 1; return(this.CurrentRangeIntersectionCalculatorV2ManagerCounter); }
protected virtual void OnInterestedNothing(RangeIntersectionCalculator intersectionCalculator) { }