Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            var mo = InputPath.Value as FsmPath;

            if ((mo == null) || (mo.Value == null) || !OutputPath.UseVariable)
            {
                Debug.Log("Input Incomplete");
                Finish();
                return;
            }             // also abort the action if there is no variable to save to.

            var a = (InputPath.Value as FsmPath).Value as ABPath;
            var b = PathPool <ABPath> .GetPath();           // I can't instantiate so there's nothing but the manual way left

            b.duration         = a.duration;
            b.heuristicScale   = a.heuristicScale;
            b.enabledTags      = a.enabledTags;
            b.radius           = a.radius;
            b.searchedNodes    = a.searchedNodes;
            b.searchIterations = a.searchIterations;
            b.speed            = a.speed;
            b.turnRadius       = a.turnRadius;
            b.recycled         = a.recycled;
            b.nnConstraint     = a.nnConstraint;
            b.path             = a.path;
            b.vectorPath       = a.vectorPath;

            OutputPath.Value = FsmConverter.SetPath(b);
            Finish();
        }
Ejemplo n.º 3
0
        public static RandomPath Construct(Vector3 start, int length, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <RandomPath>();

            p.Setup(start, length, callback);
            return(p);
        }
Ejemplo n.º 4
0
 public AstarDebugger()
 {
     AstarDebugger.PathTypeDebug[] expr_80 = new AstarDebugger.PathTypeDebug[1];
     expr_80[0]      = new AstarDebugger.PathTypeDebug("ABPath", () => PathPool.GetSize(typeof(ABPath)), () => PathPool.GetTotalCreated(typeof(ABPath)));
     this.debugTypes = expr_80;
     base..ctor();
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public static FloodPathTracer Construct(Vector3 start, FloodPath flood, OnPathDelegate callback = null)
        {
            var p = PathPool.GetPath <FloodPathTracer>();

            p.Setup(start, flood, callback);
            return(p);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        private static PathfinderPool GetPool <T>() where T : AbstractPathfinder, new()
        {
            var            type = typeof(T);
            PathfinderPool pool;

            if (_pools.TryGetValue(type, out pool))
            {
                return(pool);
            }
            pool = new PathPool <T>();
            _pools.Add(type, pool);
            return(pool);
        }