Ejemplo n.º 1
0
        /** Called when a NavmeshCut or NavmeshAdd is enabled */
        void HandleOnEnableCallback(NavmeshClipper obj)
        {
            var graphSpaceBounds = obj.GetBounds(handler.graph.transform);
            var touchingTiles    = handler.graph.GetTouchingTilesInGraphSpace(graphSpaceBounds);

            handler.cuts.Add(obj, touchingTiles);
            obj.ForceUpdate();
        }
Ejemplo n.º 2
0
 // Token: 0x060026DA RID: 9946 RVA: 0x001ADC44 File Offset: 0x001ABE44
 protected virtual void OnDisable()
 {
     if (NavmeshClipper.OnDisableCallback != null)
     {
         NavmeshClipper.OnDisableCallback(this);
     }
     NavmeshClipper.all.Remove(this.node);
 }
Ejemplo n.º 3
0
 // Token: 0x060026D9 RID: 9945 RVA: 0x001ADC20 File Offset: 0x001ABE20
 protected virtual void OnEnable()
 {
     NavmeshClipper.all.AddFirst(this.node);
     if (NavmeshClipper.OnEnableCallback != null)
     {
         NavmeshClipper.OnEnableCallback(this);
     }
 }
Ejemplo n.º 4
0
        // Token: 0x060026AC RID: 9900 RVA: 0x001A8FCC File Offset: 0x001A71CC
        private void HandleOnEnableCallback(NavmeshClipper obj)
        {
            Rect    bounds = obj.GetBounds(this.handler.graph.transform);
            IntRect touchingTilesInGraphSpace = this.handler.graph.GetTouchingTilesInGraphSpace(bounds);

            this.handler.cuts.Add(obj, touchingTilesInGraphSpace);
            obj.ForceUpdate();
        }
Ejemplo n.º 5
0
 void OnDisable()
 {
     if (handler != null)
     {
         NavmeshClipper.RemoveEnableCallback(HandleOnEnableCallback, HandleOnDisableCallback);
         forcedReloadRects.Clear();
         handler.graph.OnRecalculatedTiles -= OnRecalculatedTiles;
     }
 }
Ejemplo n.º 6
0
 public void Dirty(NavmeshClipper obj)
 {
     // If we have no handler then we can ignore this. If we would later create a handler the object would be automatically dirtied anyway.
     if (handler == null)
     {
         return;
     }
     handler.cuts.Dirty(obj);
 }
Ejemplo n.º 7
0
 // Token: 0x060026A7 RID: 9895 RVA: 0x001A8E50 File Offset: 0x001A7050
 private void OnDisable()
 {
     if (this.handler != null)
     {
         NavmeshClipper.RemoveEnableCallback(new Action <NavmeshClipper>(this.HandleOnEnableCallback), new Action <NavmeshClipper>(this.HandleOnDisableCallback));
         this.forcedReloadRects.Clear();
         NavmeshBase graph = this.handler.graph;
         graph.OnRecalculatedTiles = (Action <NavmeshTile[]>)Delegate.Remove(graph.OnRecalculatedTiles, new Action <NavmeshTile[]>(this.OnRecalculatedTiles));
     }
 }
Ejemplo n.º 8
0
 // Token: 0x060026AD RID: 9901 RVA: 0x001A901C File Offset: 0x001A721C
 private void HandleOnDisableCallback(NavmeshClipper obj)
 {
     GridLookup <NavmeshClipper> .Root root = this.handler.cuts.GetRoot(obj);
     if (root != null)
     {
         this.forcedReloadRects.Add(root.previousBounds);
         this.handler.cuts.Remove(obj);
     }
     this.lastUpdateTime = float.NegativeInfinity;
 }
Ejemplo n.º 9
0
        /** Called when a NavmeshCut or NavmeshAdd is disabled */
        void HandleOnDisableCallback(NavmeshClipper obj)
        {
            var root = handler.cuts.GetRoot(obj);

            if (root != null)
            {
                forcedReloadRects.Add(root.previousBounds);
                handler.cuts.Remove(obj);
            }
            lastUpdateTime = float.NegativeInfinity;
        }
Ejemplo n.º 10
0
        /// <summary>Called when a NavmeshCut or NavmeshAdd is disabled</summary>
        void HandleOnDisableCallback(NavmeshClipper obj)
        {
            var graphs = AstarPath.active.graphs;

            for (int i = 0; i < graphs.Length; i++)
            {
                var navmeshBase = graphs[i] as NavmeshBase;
                if (navmeshBase != null)
                {
                    navmeshBase.navmeshUpdateData.RemoveClipper(obj);
                }
            }
            lastUpdateTime = float.NegativeInfinity;
        }
Ejemplo n.º 11
0
        /// <summary>Called when a NavmeshCut or NavmeshAdd is enabled</summary>
        void HandleOnEnableCallback(NavmeshClipper obj)
        {
            var graphs = AstarPath.active.graphs;

            for (int i = 0; i < graphs.Length; i++)
            {
                var navmeshBase = graphs[i] as NavmeshBase;
                if (navmeshBase != null)
                {
                    navmeshBase.navmeshUpdateData.AddClipper(obj);
                }
            }
            obj.ForceUpdate();
        }
Ejemplo n.º 12
0
            /// <summary>Called when a NavmeshCut or NavmeshAdd is enabled</summary>
            public void AddClipper(NavmeshClipper obj)
            {
                // Without the forceCreate parameter set to true then no handler will be created
                // because there are no clippers in the scene yet. However one is being added right now.
                Refresh(true);
                if (handler == null)
                {
                    return;
                }
                var graphSpaceBounds = obj.GetBounds(handler.graph.transform);
                var touchingTiles    = handler.graph.GetTouchingTilesInGraphSpace(graphSpaceBounds);

                handler.cuts.Add(obj, touchingTiles);
            }
            /// <summary>Called when a NavmeshCut or NavmeshAdd is disabled</summary>
            public void RemoveClipper(NavmeshClipper obj)
            {
                Refresh();
                if (handler == null)
                {
                    return;
                }
                var root = handler.cuts.GetRoot(obj);

                if (root != null)
                {
                    forcedReloadRects.Add(root.previousBounds);
                    handler.cuts.Remove(obj);
                }
            }
Ejemplo n.º 14
0
        public void ForceUpdateAround(NavmeshClipper clipper)
        {
            var graphs = AstarPath.active.graphs;

            if (graphs == null)
            {
                return;
            }

            for (int i = 0; i < graphs.Length; i++)
            {
                if (graphs[i] is NavmeshBase navmeshBase)
                {
                    navmeshBase.navmeshUpdateData.Dirty(clipper);
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>Called when a NavmeshCut or NavmeshAdd is enabled</summary>
        void HandleOnEnableCallback(NavmeshClipper obj)
        {
            var graphs = AstarPath.active.graphs;

            if (graphs == null)
            {
                return;
            }

            for (int i = 0; i < graphs.Length; i++)
            {
                // Add the clipper to the individual graphs. Note that this automatically marks the clipper as dirty for that particular graph.
                if (graphs[i] is NavmeshBase navmeshBase)
                {
                    navmeshBase.navmeshUpdateData.AddClipper(obj);
                }
            }
        }
Ejemplo n.º 16
0
 // Token: 0x060026A5 RID: 9893 RVA: 0x001A8D18 File Offset: 0x001A6F18
 public void UseSpecifiedHandler(TileHandler newHandler)
 {
     if (!base.enabled)
     {
         throw new InvalidOperationException("TileHandlerHelper is disabled");
     }
     if (this.handler != null)
     {
         NavmeshClipper.RemoveEnableCallback(new Action <NavmeshClipper>(this.HandleOnEnableCallback), new Action <NavmeshClipper>(this.HandleOnDisableCallback));
         NavmeshBase graph = this.handler.graph;
         graph.OnRecalculatedTiles = (Action <NavmeshTile[]>)Delegate.Remove(graph.OnRecalculatedTiles, new Action <NavmeshTile[]>(this.OnRecalculatedTiles));
     }
     this.handler = newHandler;
     if (this.handler != null)
     {
         NavmeshClipper.AddEnableCallback(new Action <NavmeshClipper>(this.HandleOnEnableCallback), new Action <NavmeshClipper>(this.HandleOnDisableCallback));
         NavmeshBase graph2 = this.handler.graph;
         graph2.OnRecalculatedTiles = (Action <NavmeshTile[]>)Delegate.Combine(graph2.OnRecalculatedTiles, new Action <NavmeshTile[]>(this.OnRecalculatedTiles));
     }
 }
Ejemplo n.º 17
0
        /** Use the specified handler, will create one at start if not called */
        public void UseSpecifiedHandler(TileHandler newHandler)
        {
            if (!enabled)
            {
                throw new System.InvalidOperationException("TileHandlerHelper is disabled");
            }

            if (handler != null)
            {
                NavmeshClipper.RemoveEnableCallback(HandleOnEnableCallback, HandleOnDisableCallback);
                handler.graph.OnRecalculatedTiles -= OnRecalculatedTiles;
            }

            handler = newHandler;

            if (handler != null)
            {
                NavmeshClipper.AddEnableCallback(HandleOnEnableCallback, HandleOnDisableCallback);
                handler.graph.OnRecalculatedTiles += OnRecalculatedTiles;
            }
        }
Ejemplo n.º 18
0
 internal void OnDisable()
 {
     NavmeshClipper.RemoveEnableCallback(HandleOnEnableCallback, HandleOnDisableCallback);
 }