public void OnDisable() { Pathfinding.RVO.Simulator sim = AStarPathfindingUtils.GetSimulator(); RVOContourObstacle cutObstacle = GetRVOContourObstacle(); if (cutObstacle) { cutObstacle.RemoveDynamicObstacles(sim); } if (_wasActive) { if (cutObstacle) { cutObstacle.SetObstaclesActive(sim, false); } if (null != TileHandlerHelper.instance) { TileHandlerHelper.instance.OnNavMeshCutDisabled(lastBounds); } } _UpdateIsRequired = false; EventManager.instance.RemoveListener <PopulateZonesPlayingEvent>(OnPopulateZones); EventManager.instance.RemoveListener <LevelStartEvent>(OnLevelStart); }
public void NotifyUpdated() { #if BNICKSON_UPDATED Pathfinding.RVO.Simulator sim = AStarPathfindingUtils.GetSimulator(); RVOContourObstacle cutObstacle = GetRVOContourObstacle(); if (cutObstacle) { cutObstacle.SetObstaclesActive(sim, isActive); if (HasMoved()) { cutObstacle.Move(sim); } else if (_UpdateIsRequired && isActive) { cutObstacle.CreateDynamicEdgesIfNoStaticEdgesExist(sim); } } _wasActive = isActive; _UpdateIsRequired = false; #endif wasEnabled = enabled; if (wasEnabled) { lastPosition = tr.position; lastBounds = GetBounds(); if (useRotation) { lastRotation = tr.rotation; } } }
// make sure everything is correct on level start public void OnLevelStart(LevelStartEvent e) { RVOContourObstacle cutObstacle = GetRVOContourObstacle(); cutObstacle.SetObstaclesActive(AStarPathfindingUtils.GetSimulator(), isActive); }