/** 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); }
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(); }
public static RandomPath Construct(Vector3 start, int length, OnPathDelegate callback = null) { var p = PathPool.GetPath <RandomPath>(); p.Setup(start, length, callback); return(p); }
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(); }
/** 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); }
public static FloodPathTracer Construct(Vector3 start, FloodPath flood, OnPathDelegate callback = null) { var p = PathPool.GetPath <FloodPathTracer>(); p.Setup(start, flood, callback); return(p); }
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); }
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); }