コード例 #1
0
        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);
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public void OnObstacleListenerDestroyed(ObstacleListenerSystem obstacleListener)
 {
     this.obstacleListeners.Remove(obstacleListener);
 }
コード例 #4
0
 public int OnObstacleListenerCreation(ObstacleListenerSystem obstacleListener)
 {
     this.obstacleListeners.Add(obstacleListener);
     this.ObstacleListenerAddedCounter += 1;
     return(this.ObstacleListenerAddedCounter);
 }
コード例 #5
0
 public void TryGetCalculatedOcclusionFrustumsForObstacleListener(ObstacleListenerSystem ObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions)
 {
     GetCalculatedOcclusionFrustums().TryGetValue(ObstacleListener.ObstacleListenerUniqueID, out calculatedFrustumPositions);
 }
コード例 #6
0
 public List <FrustumPointsPositions> GetCalculatedOcclusionFrustums(ObstacleListenerSystem ObstacleListener, ObstacleInteractiveObject obstacleInteractiveObject)
 {
     return(GetCalculatedOcclusionFrustums()[ObstacleListener.ObstacleListenerUniqueID][obstacleInteractiveObject.ObstacleInteractiveObjectUniqueID]);
 }
コード例 #7
0
        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;
        }
コード例 #8
0
 public void OnObstacleListenerDestroyed(ObstacleListenerSystem obstacleListener)
 {
     this.CalculatedOcclusionFrustums.Remove(obstacleListener.ObstacleListenerUniqueID);
     this.ObstacleListenerLastFramePositions.Remove(obstacleListener);
     this.singleObstacleThatHasChangedThisFrame.Remove(obstacleListener);
 }