private void LateUpdate() { var d = Time.deltaTime; PlayerInteractiveObjectManager.Get().LateTick(d); InteractiveObjectV2Manager.Get().LateTick(d); PlayerActionEntryPoint.Get().LateTick(d); ObstacleOcclusionCalculationManagerV2.Get().LateTick(); RangeIntersectionCalculationManagerV2.Get().LateTick(); }
private void Update() { var d = Time.deltaTime; BeforeTick(d); TutorialManager.Get().Tick(d); PuzzleTutorialEventSenderManager.Get().Tick(d); BlockingCutscenePlayerManager.Get().Tick(d); PlayerActionEntryPoint.Get().Tick(d); PlayerInteractiveObjectManager.Get().Tick(d); PlayerInteractiveObjectManager.Get().AfterTicks(d); CameraMovementManager.Get().Tick(d); ObstacleOcclusionCalculationManagerV2.Get().Tick(d); RangeIntersectionCalculationManagerV2.Get().Tick(d); RangeObjectV2Manager.Get().Tick(d); InteractiveObjectV2Manager.Get().Tick(d); InteractiveObjectV2Manager.Get().AfterTicks(d); GroundEffectsManagerV2.Get().Tick(d); DottedLineRendererManager.Get().Tick(); SelectableObjectManagerV2.Get().Tick(d); CircleFillBarRendererManager.Get().Tick(d); #if UNITY_EDITOR EditorOnlyManagers.Tick(d); #endif }
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 ManualCalculation(List <RangeIntersectionCalculator> InvolvedRangeIntersectionCalculatorV2, bool forceCalculation) { var AllRangeIntersectionCalculatorV2Count = InvolvedRangeIntersectionCalculatorV2.Count; if (AllRangeIntersectionCalculatorV2Count > 0) { #region Counting var totalObstacleFrustumPointsCounter = 0; foreach (var rangeIntersectionCalculatorV2 in InvolvedRangeIntersectionCalculatorV2) { if (forceCalculation || !forceCalculation && rangeIntersectionCalculatorV2.TickChangedPositions()) { RangeIntersectionCalculatorThatChangedThatFrame.Add(rangeIntersectionCalculatorV2); foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.CountingForRangeIntersectionCalculator(rangeIntersectionCalculatorV2); } var associatedObstacleListener = rangeIntersectionCalculatorV2.GetAssociatedObstacleListener(); if (associatedObstacleListener != null) //The range can ignore obstacles { //Obstacle listener could have never triggered a calculation ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(associatedObstacleListener, out var calculatedFrustumPositions); if (calculatedFrustumPositions != null) { foreach (var calculatedObstacleFrustum in calculatedFrustumPositions.Values) { totalObstacleFrustumPointsCounter += calculatedObstacleFrustum.Count; } } } } } #endregion if (RangeIntersectionCalculatorThatChangedThatFrame.Count > 0) { foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.CreateNativeArrays(); } this.IsOccludedByObstacleJobData = new NativeArray <IsOccludedByObstacleJobData>(AllRangeIntersectionCalculatorV2Count, Allocator.TempJob); RangeObstacleOcclusionIntersection.Prepare(totalObstacleFrustumPointsCounter, _rangeIntersectionCalculatorManager); var currentObstacleIntersectionCalculatorCounter = 0; foreach (var RangeIntersectionCalculatorV2 in RangeIntersectionCalculatorThatChangedThatFrame) { if (RangeObstacleOcclusionIntersection.ForRangeInteresectionCalculator(RangeIntersectionCalculatorV2, ObstacleOcclusionCalculationManagerV2, out var IsOccludedByObstacleJobData)) { this.IsOccludedByObstacleJobData[currentObstacleIntersectionCalculatorCounter] = IsOccludedByObstacleJobData; currentObstacleIntersectionCalculatorCounter += 1; } foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.CalculationDataSetupForRangeIntersectionCalculator(RangeIntersectionCalculatorV2, IsOccludedByObstacleJobData, currentObstacleIntersectionCalculatorCounter); } } foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.BuildJobHandle(IsOccludedByObstacleJobData, RangeObstacleOcclusionIntersection); } if (!forceCalculation) { JobEnded = false; } else { foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.Complete(); } foreach (var RangeIntersectionmanager in RangeIntersectionmanagers) { RangeIntersectionmanager.WaitForResults(); } OnJobEnded(); } } } }
public FrustumGroundEffectManager(RangeTypeInherentConfigurationData rangeTypeInherentConfigurationData, FrustumRangeObjectRenderingDataProvider FrustumRangeObjectRenderingDataprovider) : base(rangeTypeInherentConfigurationData) { this.FrustumRangeObjectRenderingDataprovider = FrustumRangeObjectRenderingDataprovider; ObstacleOcclusionCalculationManagerV2 = ObstacleOcclusionCalculationManagerV2.Get(); }
// 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); }