private bool OcclusionCalculationDataAvailable(ObstacleListenerSystem ObstacleListenerSystem, ObstacleInteractiveObject ObstacleInteractiveObject) { this.CalculatedOcclusionFrustums.TryGetValue(ObstacleListenerSystem.ObstacleListenerUniqueID, out Dictionary <int, List <FrustumPointsPositions> > FrustumPointsPositionsByObstacle); if (FrustumPointsPositionsByObstacle != null) { FrustumPointsPositionsByObstacle.TryGetValue(ObstacleInteractiveObject.ObstacleInteractiveObjectUniqueID, out List <FrustumPointsPositions> FrustumPointsPositions); if (FrustumPointsPositions != null) { return(true); } } return(false); }
private void ClearAndCreateCalculatedFrustums(ObstacleListenerSystem obstacleListener, ObstacleInteractiveObject obstalceInteractiveObject) { CalculatedOcclusionFrustums.TryGetValue(obstacleListener.ObstacleListenerUniqueID, out var obstalceFrustumPointsPositions); if (obstalceFrustumPointsPositions == null) { CalculatedOcclusionFrustums.Add(obstacleListener.ObstacleListenerUniqueID, new Dictionary <int, List <FrustumPointsPositions> >()); obstalceFrustumPointsPositions = CalculatedOcclusionFrustums[obstacleListener.ObstacleListenerUniqueID]; } obstalceFrustumPointsPositions.TryGetValue(obstalceInteractiveObject.ObstacleInteractiveObjectUniqueID, out var squareObstacleFrustumPositions); if (squareObstacleFrustumPositions == null) { obstalceFrustumPointsPositions.Add(obstalceInteractiveObject.ObstacleInteractiveObjectUniqueID, new List <FrustumPointsPositions>()); } else { squareObstacleFrustumPositions.Clear(); } }
public void OnObstacleListenerDestroyed(ObstacleListenerSystem obstacleListener) { this.obstacleListeners.Remove(obstacleListener); }
public int OnObstacleListenerCreation(ObstacleListenerSystem obstacleListener) { this.obstacleListeners.Add(obstacleListener); this.ObstacleListenerAddedCounter += 1; return(this.ObstacleListenerAddedCounter); }
public void TryGetCalculatedOcclusionFrustumsForObstacleListener(ObstacleListenerSystem ObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions) { GetCalculatedOcclusionFrustums().TryGetValue(ObstacleListener.ObstacleListenerUniqueID, out calculatedFrustumPositions); }
public List <FrustumPointsPositions> GetCalculatedOcclusionFrustums(ObstacleListenerSystem ObstacleListener, ObstacleInteractiveObject obstacleInteractiveObject) { return(GetCalculatedOcclusionFrustums()[ObstacleListener.ObstacleListenerUniqueID][obstacleInteractiveObject.ObstacleInteractiveObjectUniqueID]); }
private static void AddToArrays(ref NativeArray <FrustumOcclusionCalculationData> FrustumOcclusionCalculationDatas, NativeArray <FrustumV2Indexed> AssociatedFrustums, ref int currentOcclusionCalculationCounter, ref int currentFrustumCounter, ObstacleListenerSystem obstacleListenerThatChanged, ObstacleInteractiveObject nearSquareObstacle) { foreach (var nearSquaureObstacleFrustum in nearSquareObstacle.GetFaceFrustums()) { AssociatedFrustums[currentFrustumCounter] = new FrustumV2Indexed { FrustumV2 = nearSquaureObstacleFrustum, CalculationDataIndex = currentOcclusionCalculationCounter }; currentFrustumCounter += 1; } FrustumOcclusionCalculationDatas[currentOcclusionCalculationCounter] = new FrustumOcclusionCalculationData { FrustumCalculationDataID = new FrustumCalculationDataID { ObstacleListenerUniqueID = obstacleListenerThatChanged.ObstacleListenerUniqueID, SquareObstacleSystemUniqueID = nearSquareObstacle.ObstacleInteractiveObjectUniqueID, }, ObstacleListenerTransform = obstacleListenerThatChanged.AssociatedRangeTransformProvider(), SquareObstacleTransform = nearSquareObstacle.GetObstacleCenterTransform() }; currentOcclusionCalculationCounter += 1; }
public void OnObstacleListenerDestroyed(ObstacleListenerSystem obstacleListener) { this.CalculatedOcclusionFrustums.Remove(obstacleListener.ObstacleListenerUniqueID); this.ObstacleListenerLastFramePositions.Remove(obstacleListener); this.singleObstacleThatHasChangedThisFrame.Remove(obstacleListener); }