Пример #1
0
        public void Recycle()
        {
            this.result       = PathCompleteState.NotCalculated;
            this.graph        = null;
            this.cacheEnabled = default;

            if (this.nodes != null)
            {
                PoolListCopyable <Node> .Recycle(ref this.nodes);
            }
            if (this.nodesModified != null)
            {
                PoolListCopyable <Node> .Recycle(ref this.nodesModified);
            }

            if (this.cacheEnabled == false && this.flowField.arr != null)
            {
                PoolArray <byte> .Recycle(ref this.flowField);
            }

            if (this.navMeshPoints != null)
            {
                PoolListCopyable <Vector3> .Recycle(ref this.navMeshPoints);
            }
        }
Пример #2
0
        /** Reset all values to their default values.
         *
         * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
         * override this function, resetting ALL their variables to enable recycling of paths.
         * If this is not done, trying to use that path type for pooling might result in weird behaviour.
         * The best way is to reset to default values the variables declared in the extended path type and then
         * call this base function in inheriting types with base.Reset ().
         *
         * \warning This function should not be called manually.
         */
        public virtual void Reset()
        {
#if ASTAR_POOL_DEBUG
            pathTraceInfo  = "This path was got from the pool or created from here (stacktrace):\n";
            pathTraceInfo += System.Environment.StackTrace;
#endif

            if (System.Object.ReferenceEquals(AstarPath.active, null))
            {
                throw new System.NullReferenceException("No AstarPath object found in the scene. " +
                                                        "Make sure there is one or do not create paths in Awake");
            }

            hasBeenReset      = true;
            state             = (int)PathState.Created;
            releasedNotSilent = false;

            pathHandler       = null;
            callback          = null;
            _errorLog         = "";
            pathCompleteState = PathCompleteState.NotCalculated;

            path = Pathfinding.Util.ListPool <GraphNode> .Claim();

            vectorPath = Pathfinding.Util.ListPool <Vector3> .Claim();

            currentR = null;

            duration         = 0;
            searchIterations = 0;
            searchedNodes    = 0;
            //calltime

            nnConstraint = PathNNConstraint.Default;
            next         = null;

            radius          = 0;
            walkabilityMask = -1;
            height          = 0;
            turnRadius      = 0;
            speed           = 0;

            //heuristic = (Heuristic)0;
            //heuristicScale = 1F;
            heuristic      = AstarPath.active.heuristic;
            heuristicScale = AstarPath.active.heuristicScale;

            pathID       = 0;
            enabledTags  = -1;
            tagPenalties = null;

            callTime = System.DateTime.UtcNow;
            pathID   = AstarPath.active.GetNextPathID();

            hTarget     = Int3.zero;
            hTargetNode = null;
        }
Пример #3
0
        /** Reset all values to their default values.
         *
         * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
         * override this function, resetting ALL their variables to enable recycling of paths.
         * If this is not done, trying to use that path type for pooling might result in weird behaviour.
         * The best way is to reset to default values the variables declared in the extended path type and then
         * call this base function in inheriting types with base.Reset ().
         *
         * \warning This function should not be called manually.
         */
        public virtual void Reset()
        {
            if (ReferenceEquals(AstarPath.active, null))
            {
                throw new NullReferenceException("No AstarPath object found in the scene. " +
                                                 "Make sure there is one or do not create paths in Awake");
            }

            hasBeenReset      = true;
            state             = (int)PathState.Created;
            releasedNotSilent = false;

            pathHandler       = null;
            callback          = null;
            _errorLog         = "";
            pathCompleteState = PathCompleteState.NotCalculated;

            path = ListPool <GraphNode> .Claim();

            vectorPath = ListPool <Vector3> .Claim();

            currentR = null;

            duration         = 0;
            searchIterations = 0;
            searchedNodes    = 0;
            //calltime

            nnConstraint = PathNNConstraint.Default;
            next         = null;

            radius          = 0;
            walkabilityMask = -1;
            height          = 0;
            turnRadius      = 0;
            speed           = 0;

            //heuristic = (Heuristic)0;
            //heuristicScale = 1F;
            heuristic      = AstarPath.active.heuristic;
            heuristicScale = AstarPath.active.heuristicScale;

            pathID       = 0;
            enabledTags  = -1;
            tagPenalties = null;

            callTime = DateTime.UtcNow;
            pathID   = AstarPath.active.GetNextPathID();

            hTarget     = Int3.zero;
            hTargetNode = null;
        }
Пример #4
0
        /** Reset all values to their default values.
         *
         * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
         * override this function, resetting ALL their variables to enable pooling of paths.
         * If this is not done, trying to use that path type for pooling could result in weird behaviour.
         * The best way is to reset to default values the variables declared in the extended path type and then
         * call the base function in inheriting types with base.Reset().
         */
        protected virtual void Reset()
        {
#if ASTAR_POOL_DEBUG
            pathTraceInfo  = "This path was got from the pool or created from here (stacktrace):\n";
            pathTraceInfo += System.Environment.StackTrace;
#endif

            if (System.Object.ReferenceEquals(AstarPath.active, null))
            {
                throw new System.NullReferenceException("No AstarPath object found in the scene. " +
                                                        "Make sure there is one or do not create paths in Awake");
            }

            hasBeenReset      = true;
            PipelineState     = (int)PathState.Created;
            releasedNotSilent = false;

            pathHandler       = null;
            callback          = null;
            immediateCallback = null;
            errorLog          = "";
            completeState     = PathCompleteState.NotCalculated;

            path = Pathfinding.Util.ListPool <GraphNode> .Claim();

            //Good Game
            //vectorPath = Pathfinding.Util.ListPool<Vector3>.Claim();
            vectorPath = Pathfinding.Util.ListPool <VInt3> .Claim();

            currentR = null;

            duration      = 0;
            searchedNodes = 0;

            nnConstraint = PathNNConstraint.Default;
            next         = null;

            heuristic      = AstarPath.active.heuristic;
            heuristicScale = AstarPath.active.heuristicScale;

            enabledTags  = -1;
            tagPenalties = null;

            pathID = AstarPath.active.GetNextPathID();

            hTarget     = VInt3.zero;
            hTargetNode = null;

            traversalProvider = null;
        }
Пример #5
0
        public virtual void Reset()
        {
            if (object.ReferenceEquals(AstarPath.active, null))
            {
                Debug.LogError("No AstarPath object found in the scene. Make sure there is one or do not create paths in Awake");
            }
            this.hasBeenReset      = true;
            this.state             = PathState.Created;
            this.releasedNotSilent = false;
            this.pathHandler       = null;
            this.callback          = null;
            this._errorLog         = string.Empty;
            this.pathCompleteState = PathCompleteState.NotCalculated;
            this.path = ListPool <GraphNode> .Claim(64);

            this.vectorPath = ListPool <VInt3> .Claim(64);

            this.currentR         = null;
            this.duration         = 0f;
            this.searchIterations = 0;
            this.searchedNodes    = 0;
            this.nnConstraint     = PathNNConstraint.Default;
            this.next             = null;
            this.radius           = 0;
            this.walkabilityMask  = -1;
            this.height           = 0;
            this.turnRadius       = 0;
            this.speed            = 0;
            this.pathID           = 0;
            this.enabledTags      = -1;
            this.tagPenalties     = null;
            this.callTime         = DateTime.get_UtcNow();
            AstarPath active = AstarPath.active;

            if (active != null)
            {
                this.pathID         = AstarPath.active.GetNextPathID();
                this.heuristic      = AstarPath.active.heuristic;
                this.heuristicScale = AstarPath.active.heuristicScale;
            }
            else
            {
                this.heuristic      = Heuristic.Manhattan;
                this.heuristicScale = 1f;
            }
            this.hTarget     = VInt3.zero;
            this.hTargetNode = null;
        }
    static int get_CompleteState(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Pathfinding.Path  obj = (Pathfinding.Path)o;
            PathCompleteState ret = obj.CompleteState;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CompleteState on a nil value"));
        }
    }
Пример #7
0
        /** Reset all values to their default values.
         *
         * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
         * override this function, resetting ALL their variables to enable pooling of paths.
         * If this is not done, trying to use that path type for pooling could result in weird behaviour.
         * The best way is to reset to default values the variables declared in the extended path type and then
         * call the base function in inheriting types with base.Reset().
         */
        protected virtual void Reset()
        {
#if ASTAR_POOL_DEBUG
            pathTraceInfo  = "This path was got from the pool or created from here (stacktrace):\n";
            pathTraceInfo += System.Environment.StackTrace;
#endif

            hasBeenReset      = true;
            PipelineState     = (int)PathState.Created;
            releasedNotSilent = false;

            pathHandler       = null;
            callback          = null;
            immediateCallback = null;
            errorLog          = "";
            completeState     = PathCompleteState.NotCalculated;

            path = ListPool <GraphNode> .Claim();

            vectorPath = ListPool <Vector3> .Claim();

            currentR = null;

            duration      = 0;
            searchedNodes = 0;

            nnConstraint = PathNNConstraint.Default;
            next         = null;

            heuristic      = PathFindHelper.heuristic;
            heuristicScale = PathFindHelper.heuristicScale;

            enabledTags  = -1;
            tagPenalties = null;

            pathID = PathFindHelper.GetNextPathID();

            hTarget     = Int3.zero;
            hTargetNode = null;

            traversalProvider = null;
        }
Пример #8
0
		/** Reset all values to their default values.
		 *
		 * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
		 * override this function, resetting ALL their variables to enable recycling of paths.
		 * If this is not done, trying to use that path type for pooling might result in weird behaviour.
		 * The best way is to reset to default values the variables declared in the extended path type and then
		 * call this base function in inheriting types with base.Reset ().
		 *
		 * \warning This function should not be called manually.
		  */
		public virtual void Reset () {

			if (System.Object.ReferenceEquals (AstarPath.active, null))
				throw new System.NullReferenceException ("No AstarPath object found in the scene. " +
					"Make sure there is one or do not create paths in Awake");

			hasBeenReset = true;
			state = (int)PathState.Created;
			releasedNotSilent = false;

			pathHandler = null;
			callback = null;
			_errorLog = "";
			pathCompleteState = PathCompleteState.NotCalculated;

			path = Pathfinding.Util.ListPool<GraphNode>.Claim();
			vectorPath = Pathfinding.Util.ListPool<Vector3>.Claim();

			currentR = null;

			duration = 0;
			searchIterations = 0;
			searchedNodes = 0;
			//calltime

			nnConstraint = PathNNConstraint.Default;
			next = null;

			heuristic = AstarPath.active.heuristic;
			heuristicScale = AstarPath.active.heuristicScale;

			enabledTags = -1;
			tagPenalties = null;

			callTime = System.DateTime.UtcNow;
			pathID = AstarPath.active.GetNextPathID ();

			hTarget = Int3.zero;
			hTargetNode = null;
		}
Пример #9
0
 public virtual void Reset()
 {
     if (object.ReferenceEquals(AstarPath.active, null))
     {
         throw new NullReferenceException("No AstarPath object found in the scene. Make sure there is one or do not create paths in Awake");
     }
     this.hasBeenReset = true;
     this.state = PathState.Created;
     this.releasedNotSilent = false;
     this.pathHandler = null;
     this.callback = null;
     this._errorLog = string.Empty;
     this.pathCompleteState = PathCompleteState.NotCalculated;
     this.path = ListPool<GraphNode>.Claim();
     this.vectorPath = ListPool<Vector3>.Claim();
     this.currentR = null;
     this.duration = 0f;
     this.searchIterations = 0;
     this.searchedNodes = 0;
     this.nnConstraint = PathNNConstraint.Default;
     this.next = null;
     this.heuristic = AstarPath.active.heuristic;
     this.heuristicScale = AstarPath.active.heuristicScale;
     this.enabledTags = -1;
     this.tagPenalties = null;
     this.callTime = DateTime.UtcNow;
     this.pathID = AstarPath.active.GetNextPathID();
     this.hTarget = Int3.zero;
     this.hTargetNode = null;
 }
Пример #10
0
        /** Reset all values to their default values.
         *
         * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
         * override this function, resetting ALL their variables to enable recycling of paths.
         * If this is not done, trying to use that path type for pooling might result in weird behaviour.
         * The best way is to reset to default values the variables declared in the extended path type and then
         * call this base function in inheriting types with base.Reset ().
         *
         * \warning This function should not be called manually.
          */
        public virtual void Reset()
        {
            if (AstarPath.active == null)
                throw new System.NullReferenceException ("No AstarPath object found in the scene. " +
                    "Make sure there is one or do not create paths in Awake");

            hasBeenReset = true;
            state = (int)PathState.Created;
            releasedNotSilent = false;

            runData = null;
            callback = null;
            _errorLog = "";
            pathCompleteState = PathCompleteState.NotCalculated;

            path = Pathfinding.Util.ListPool<Node>.Claim();
            vectorPath = Pathfinding.Util.ListPool<Vector3>.Claim();

            currentR = null;

            duration = 0;
            searchIterations = 0;
            searchedNodes = 0;
            //calltime

            nnConstraint = PathNNConstraint.Default;
            next = null;

            radius = 0;
            walkabilityMask = -1;
            height = 0;
            turnRadius = 0;
            speed = 0;

            //heuristic = (Heuristic)0;
            //heuristicScale = 1F;
            heuristic = AstarPath.active.heuristic;
            heuristicScale = AstarPath.active.heuristicScale;

            pathID = 0;
            enabledTags = -1;
            tagPenalties = null;

            callTime = System.DateTime.UtcNow;
            pathID = AstarPath.active.GetNextPathID ();
        }
Пример #11
0
		/** Reset all values to their default values.
		 * 
		 * \note All inheriting path types (e.g ConstantPath, RandomPath, etc.) which declare their own variables need to
		 * override this function, resetting ALL their variables to enable recycling of paths.
		 * If this is not done, trying to use that path type for pooling might result in weird behaviour.
		 * The best way is to reset to default values the variables declared in the extended path type and then
		 * call this base function in inheriting types with base.Reset ().
		 * 
		 * \warning This function should not be called manually.
		  */
		public virtual void Reset () {
#if ASTAR_POOL_DEBUG
			pathTraceInfo = "This path was got from the pool or created from here (stacktrace):\n";
			pathTraceInfo += System.Environment.StackTrace;
#endif
				
			if (AstarPath.active == null)
				throw new System.NullReferenceException ("No AstarPath object found in the scene. " +
					"Make sure there is one or do not create paths in Awake");
			
			hasBeenReset = true;
			state = (int)PathState.Created;
			releasedNotSilent = false;
			
			pathHandler = null;
			callback = null;
			_errorLog = "";
			pathCompleteState = PathCompleteState.NotCalculated;
			
			path = Pathfinding.Util.ListPool<GraphNode>.Claim();
			vectorPath = Pathfinding.Util.ListPool<Vector3>.Claim();
			
			currentR = null;
			
			duration = 0;
			searchIterations = 0;
			searchedNodes = 0;
			//calltime
			
			nnConstraint = PathNNConstraint.Default;
			next = null;
			
			radius = 0;
			walkabilityMask = -1;
			height = 0;
			turnRadius = 0;
			speed = 0;
			
			//heuristic = (Heuristic)0;
			//heuristicScale = 1F;
			heuristic = AstarPath.active.heuristic;
			heuristicScale = AstarPath.active.heuristicScale;
			
			pathID = 0;
			enabledTags = -1;
			tagPenalties = null;
			
			callTime = System.DateTime.UtcNow;
			pathID = AstarPath.active.GetNextPathID ();
			
			hTarget = Int3.zero;
		}