//public static IEnumerable FindPath(IQPathWorld world, IQPathUnit unit, IQPathTile startTile, IQPathTile endTile)


        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            Util.WriteDebugLog(string.Format("QPath::FindPath() run"), GameManager.LogLevel_Error, GameManager.instance.debug, GameManager.instance.LogLevel);

            if (world == null || unit == null | startTile == null || endTile == null)
            {
                Util.WriteDebugLog(string.Format("Null value passed to QPath::FindPath()"), GameManager.LogLevel_Error, GameManager.instance.debug, GameManager.instance.LogLevel);
                Debug.LogError("QPath::FindPath() ERROR");
                return(null);
            }

            // Call on our actual path solver
            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();

            //TODO fix this
            return(resolver.GetList());
        }
Exemplo n.º 2
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            DebugLogger.Trace("QPath::FindPath");
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                DebugLogger.Log(LogLevel.Error, "null values passed to FindPath", "QPath");
                return(null);
            }

            // Call on our actual path solver


            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();

            DebugLogger.Trace("QPath::FindPath");
            return(resolver.GetList());
        }
Exemplo n.º 3
0
        public QPath_AStar(IQPathUnit unit, T startTile, T endTile, CostEstimateDelegate costEstimateFunc)
        {
            this.unit      = unit;
            this.startTile = startTile;
            this.endTile   = endTile;

            this.costEstimateFunc = costEstimateFunc;
        }
Exemplo n.º 4
0
 public QPath_AStar(
     IQPathWorld world,
     IQPathUnit unit,
     T starttile,
     T endtile,
     CostEstimateDelegate CostEstimateFunc)
 {
     this.world            = world;
     this.unit             = unit;
     this.starttile        = starttile;
     this.endtile          = endtile;
     this.CostEstimateFunc = CostEstimateFunc;
 }
Exemplo n.º 5
0
        public static T[] FindPath <T>(IQPathUnit unit, T startTile, T endTile, CostEstimateDelegate costEstimateFunc) where T : IQPathTile
        {
            if (unit == null || startTile == null || endTile == null)
            {
                Debug.LogError("null values passed to QPath::FindPath");
                return(null);
            }

            QPath_AStar <T> resolver = new QPath_AStar <T>(unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();

            return(resolver.GetList());
        }
 public QPath_AStarScript(
     IQPathWorldScript World,
     IQPathUnitScript Unit,
     T StartTile,
     T EndTile,
     CostEstimateDelegate CostEstimateFunction
     )
 {
     this.world                = World;
     this.unit                 = Unit;
     this.startTile            = StartTile;
     this.endTile              = EndTile;
     this.costEstimateFunction = CostEstimateFunction;
 }
Exemplo n.º 7
0
        public QPath_AStar(IQPathWorld world,
                           IQPathUnit unit,
                           T startTile,
                           T endTile,
                           CostEstimateDelegate costEstimateFunc)
        {
            this.world     = world;
            this.unit      = unit;
            this.startTile = startTile;
            this.endTile   = endTile;
            this.costEstimateDelegateFunc = costEstimateFunc;

            // Do we need to explicitly create a graph?
        }
Exemplo n.º 8
0
 public QPath_AStar(
     IQPathWorld theWorld,
     IQPathUnit theUnit,
     T startTile,
     T endTile,
     CostEstimateDelegate costEstimateFunc
     )
 {
     // Do Setup
     this.theWorld         = theWorld;
     this.theUnit          = theUnit;
     this.startTile        = startTile;
     this.endTile          = endTile;
     this.costEstimateFunc = costEstimateFunc;
 }
Exemplo n.º 9
0
 public QPath_AStar(
     IQPathWorld world,
     IQPathUnit unit,
     T startTile,
     T endTile,
     CostEstimateDelegate costEstimateFunc
     )
 {
     // Setup
     this.world            = world;
     this.unit             = unit;
     this.startTile        = startTile;
     this.endTile          = endTile;
     this.costEstimateFunc = costEstimateFunc;
 }
Exemplo n.º 10
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                return(null);
            }

            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();
            return(resolver.GetList());
        }
Exemplo n.º 11
0
        public static T[] FindPath <T>(
            IQPathWorld theWorld,
            IQPathUnit theUnit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            // Debug.Log("QPath started!");
            if (theWorld == null || theUnit == null || startTile == null || endTile == null)
            {
                Debug.LogError("Null in pathfinding QPath:IQPathTile:FindPath");
                return(null);
            }

            QPath_AStar <T> resolver = new QPath_AStar <T>(theWorld, theUnit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();
            return(resolver.GetList());
        }
Exemplo n.º 12
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                Debug.LogError("Null values passed to QPath::FindPath");
                return(null);
            }

            // Call on path solver (could have different types)
            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();

            return(resolver.GetList());
        }
Exemplo n.º 13
0
        public static T[] FindPath <T>(
            IQPathWorldScript world,
            IQPathUnitScript unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunction
            ) where T : IQPathTileScript
        {
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                Debug.LogError("Null Value passed  to QPath::FindPath");
                return(null);
            }

            // Call on our actual path solver
            QPath_AStarScript <T> resolver = new QPath_AStarScript <T>(world, unit, startTile, endTile, costEstimateFunction);

            resolver.DoWork();

            return(resolver.GetList());
        }
Exemplo n.º 14
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T starttile,
            T endtile,
            CostEstimateDelegate CostEstimateFunc

            ) where T : IQPathTile
        {
            //Debug.Log("Running Status");

            if (world == null || unit == null || starttile == null || endtile == null)
            {
                Debug.LogError("null values passes");
            }

            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, starttile, endtile, CostEstimateFunc);

            resolver.DoWork();

            return(resolver.GetList());
        }
Exemplo n.º 15
0
        public static T[] FindPath <T>( //<T> define FindPath as generic - specify object type inside angle braces (that implements IQPathTile)
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile //requires (guarentees) that whatever class T is, it implements IQPathTile
        {
            //error checking
            Debug.Log("QPath::FindPath");
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                Debug.LogError("null values passed to QPath::FindPath");
                return(null);
            }

            // Call on the path solver (A* in this case)

            QPath_AStar <T> resolver = new QPath_AStar <T>(world, unit, startTile, endTile, costEstimateFunc);

            resolver.DoWork();

            return(resolver.GetList());
        }