Exemplo n.º 1
0
        public static FleePath Construct(Vector3 start, Vector3 avoid, int searchLength, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            FleePath path = PathPool.GetPath <FleePath>();

            path.Setup(start, avoid, searchLength, callback);
            return(path);
        }
Exemplo n.º 2
0
        public static RandomPath Construct(Vector3 start, int length, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            RandomPath path = PathPool.GetPath <RandomPath>();

            path.Setup(start, length, callback);
            return(path);
        }
Exemplo n.º 3
0
        //Good Game
        //public static RandomPath Construct (Vector3 start, int length, OnPathDelegate callback = null) {
        public static RandomPath Construct(VInt3 start, int length, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <RandomPath>();

            p.Setup(start, length, callback);
            return(p);
        }
Exemplo n.º 4
0
        public static FloodPathTracer Construct(Vector3 start, FloodPath flood, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            FloodPathTracer path = PathPool.GetPath <FloodPathTracer>();

            path.Setup(start, flood, callback);
            return(path);
        }
Exemplo n.º 5
0
        // Token: 0x06002741 RID: 10049 RVA: 0x001B035C File Offset: 0x001AE55C
        public static FloodPathTracer Construct(Vector3 start, FloodPath flood, OnPathDelegate callback = null)
        {
            FloodPathTracer path = PathPool.GetPath <FloodPathTracer>();

            path.Setup(start, flood, callback);
            return(path);
        }
Exemplo n.º 6
0
        public static MultiTargetPath Construct(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback = null)
        {
            MultiTargetPath path = PathPool.GetPath <MultiTargetPath>();

            path.Setup(start, targets, callbackDelegates, callback);
            return(path);
        }
Exemplo n.º 7
0
        // Token: 0x06000761 RID: 1889 RVA: 0x00048158 File Offset: 0x00046558
        public static FloodPath Construct(Vector3 start, OnPathDelegate callback = null)
        {
            FloodPath path = PathPool <FloodPath> .GetPath();

            path.Setup(start, callback);
            return(path);
        }
Exemplo n.º 8
0
        /** Constructs a new FleePath.
         * The FleePath will be taken from a pool.
         */
        public static FleePath Construct(Vector3 start, Vector3 avoid, int searchLength, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <FleePath>();

            p.Setup(start, avoid, searchLength, callback);
            return(p);
        }
Exemplo n.º 9
0
        public static ABPath Construct(ref VInt3 start, ref VInt3 end, OnPathDelegate callback = null)
        {
            ABPath path = PathPool <ABPath> .GetPath();

            path.Setup(ref start, ref end, callback);
            return(path);
        }
Exemplo n.º 10
0
        public static MultiTargetPath Construct(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            MultiTargetPath path = PathPool.GetPath <MultiTargetPath>();

            path.Setup(start, targets, callbackDelegates, callback);
            return(path);
        }
Exemplo n.º 11
0
        public static ConstantPath Construct(Vector3 start, int maxGScore, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            ConstantPath path = PathPool.GetPath <ConstantPath>();

            path.Setup(start, maxGScore, callback);
            return(path);
        }
Exemplo n.º 12
0
        public static ABPath Construct(Vector3 start, Vector3 end, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            ABPath path = PathPool.GetPath <ABPath>();

            path.Setup(start, end, callback);
            return(path);
        }
Exemplo n.º 13
0
        //Good Game
        //public static MultiTargetPath Construct (Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback = null) {
        public static MultiTargetPath Construct(VInt3 start, VInt3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <MultiTargetPath>();

            p.Setup(start, targets, callbackDelegates, callback);
            return(p);
        }
Exemplo n.º 14
0
        public static ConstantPath Construct(Vector3 start, int maxGScore, OnPathDelegate callback = null)
        {
            ConstantPath path = PathPool <ConstantPath> .GetPath();

            path.Setup(start, maxGScore, callback);
            return(path);
        }
Exemplo n.º 15
0
        public static ABPath Construct(Vector3 start, Vector3 end, OnPathDelegate callback = null)
        {
            ABPath path = PathPool <ABPath> .GetPath();

            path.Setup(start, end, callback);
            return(path);
        }
Exemplo n.º 16
0
        public static FloodPath Construct(Vector3 start, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <FloodPath>();

            p.Setup(start, callback);
            return(p);
        }
Exemplo n.º 17
0
        /** Construct a path with a start and end point.
         * The delegate will be called when the path has been calculated.
         * Do not confuse it with the Seeker callback as they are sent at different times.
         * If you are using a Seeker to start the path you can set \a callback to null.
         *
         * \returns The constructed path object
         */
        public static ABPath Construct(Vector3 start, Vector3 end, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <ABPath>();

            p.Setup(start, end, callback);
            return(p);
        }
Exemplo n.º 18
0
        /** Construct a path with a start and end point.
         * The delegate will be called when the path has been calculated.
         * Do not confuse it with the Seeker callback as they are sent at different times.
         * If you are using a Seeker to start the path you can set \a callback to null.
         *
         * \returns The constructed path object
         */
        public static ABTilePath Construct(Tile start, Tile end, OnPathDelegate callback = null)
        {
            ABTilePath p = PathPool <ABTilePath> .GetPath();

            p.Setup(start, end, callback);
            return(p);
        }
Exemplo n.º 19
0
        public static FleePath Construct(Vector3 start, Vector3 avoid, int searchLength, OnPathDelegate callback = null)
        {
            FleePath path = PathPool <FleePath> .GetPath();

            path.Setup(start, avoid, searchLength, callback);
            return(path);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Creates a fake path.
        /// Creates a path that looks almost exactly like it would if the pathfinding system had calculated it.
        ///
        /// This is useful if you want your agents to follow some known path that cannot be calculated using the pathfinding system for some reason.
        ///
        /// <code>
        /// var path = ABPath.FakePath(new List<Vector3> { new Vector3(1, 2, 3), new Vector3(4, 5, 6) });
        ///
        /// ai.SetPath(path);
        /// </code>
        ///
        /// You can use it to combine existing paths like this:
        ///
        /// <code>
        /// var a = Vector3.zero;
        /// var b = new Vector3(1, 2, 3);
        /// var c = new Vector3(2, 3, 4);
        /// var path1 = ABPath.Construct(a, b);
        /// var path2 = ABPath.Construct(b, c);
        ///
        /// AstarPath.StartPath(path1);
        /// AstarPath.StartPath(path2);
        /// path1.BlockUntilCalculated();
        /// path2.BlockUntilCalculated();
        ///
        /// // Combine the paths
        /// // Note: Skip the first element in the second path as that will likely be the last element in the first path
        /// var newVectorPath = path1.vectorPath.Concat(path2.vectorPath.Skip(1)).ToList();
        /// var newNodePath = path1.path.Concat(path2.path.Skip(1)).ToList();
        /// var combinedPath = ABPath.FakePath(newVectorPath, newNodePath);
        /// </code>
        /// </summary>
        public static ABPath FakePath(List <Vector3> vectorPath, List <GraphNode> nodePath = null)
        {
            var path = PathPool.GetPath <ABPath>();

            for (int i = 0; i < vectorPath.Count; i++)
            {
                path.vectorPath.Add(vectorPath[i]);
            }

            path.completeState = PathCompleteState.Complete;
            ((IPathInternals)path).AdvanceState(PathState.Returned);

            if (vectorPath.Count > 0)
            {
                path.UpdateStartEnd(vectorPath[0], vectorPath[vectorPath.Count - 1]);
            }

            if (nodePath != null)
            {
                for (int i = 0; i < nodePath.Count; i++)
                {
                    path.path.Add(nodePath[i]);
                }
                if (nodePath.Count > 0)
                {
                    path.startNode = nodePath[0];
                    path.endNode   = nodePath[nodePath.Count - 1];
                }
            }

            return(path);
        }
Exemplo n.º 21
0
        // Token: 0x06002761 RID: 10081 RVA: 0x001B14A5 File Offset: 0x001AF6A5
        public static RandomPath Construct(Vector3 start, int length, OnPathDelegate callback = null)
        {
            RandomPath path = PathPool.GetPath <RandomPath>();

            path.Setup(start, length, callback);
            return(path);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Constructs a ConstantPath starting from the specified point.
        ///
        /// Searching will be stopped when a node has a G score (cost to reach it) greater or equal to maxGScore
        /// in order words it will search all nodes with a cost to get there less than maxGScore.
        /// </summary>
        /// <param name="start">From where the path will be started from (the closest node to that point will be used)</param>
        /// <param name="maxGScore">Searching will be stopped when a node has a G score greater than this</param>
        /// <param name="callback">Will be called when the path has completed, leave this to null if you use a Seeker to handle calls</param>
        public static ConstantPath Construct(Vector3 start, int maxGScore, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <ConstantPath>();

            p.Setup(start, maxGScore, callback);
            return(p);
        }
Exemplo n.º 23
0
        //Good Game
        //public static FloodPathTracer Construct (Vector3 start, FloodPath flood, OnPathDelegate callback = null) {
        public static FloodPathTracer Construct(VInt3 start, FloodPath flood, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <FloodPathTracer>();

            p.Setup(start, flood, callback);
            return(p);
        }
Exemplo n.º 24
0
        public new static XPath Construct(Vector3 start, Vector3 end, OnPathDelegate callback = null)
        {
            XPath path = PathPool <XPath> .GetPath();

            path.Setup(start, end, callback);
            path.endingCondition = new ABPathEndingCondition(path);
            return(path);
        }
Exemplo n.º 25
0
        public new static XPath Construct(Vector3 start, Vector3 end, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <XPath>();

            p.Setup(start, end, callback);
            p.endingCondition = new ABPathEndingCondition(p);
            return(p);
        }
Exemplo n.º 26
0
        public static XPath Construct(Vector3 start, Vector3 end, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            XPath p = PathPool.GetPath <XPath>();

            p.Setup(start, end, callback);
            p.endingCondition = new ABPathEndingCondition(p);
            return(p);
        }
Exemplo n.º 27
0
        public static FloodPath Construct(GraphNode start, OnPathDelegate callback = null)
        {
            if (start == null)
            {
                throw new ArgumentNullException("start");
            }
            FloodPath path = PathPool <FloodPath> .GetPath();

            path.Setup(start, callback);
            return(path);
        }
Exemplo n.º 28
0
        public static FloodPath Construct(GraphNode start, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            if (start == null)
            {
                throw new ArgumentNullException("start");
            }
            FloodPath path = PathPool.GetPath <FloodPath>();

            path.Setup(start, callback);
            return(path);
        }
Exemplo n.º 29
0
        public static void Warmup(int count, int length)
        {
            ListPool <GraphNode> .Warmup(count, length);

            ListPool <Vector3> .Warmup(count, length);

            Path[] array = new Path[count];
            for (int i = 0; i < count; i++)
            {
                array[i] = PathPool <T> .GetPath();

                array[i].Claim(array);
            }
            for (int j = 0; j < count; j++)
            {
                array[j].Release(array);
            }
        }
Exemplo n.º 30
0
        public static void Warmup(int count, int length)
        {
            ListPool <GraphNode> .Warmup(count, length);

            ListPool <Vector3> .Warmup(count, length);

            Path[] o = new Path[count];
            for (int i = 0; i < count; i++)
            {
                o[i] = PathPool <T> .GetPath();

                o[i].Claim(o);
            }
            for (int j = 0; j < count; j++)
            {
                o[j].Release(o, false);
            }
        }