Exemplo n.º 1
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());
        }
        //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.º 3
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.º 4
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.º 5
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile,
            CostEstimateDelegate costEstimateFunc
            ) where T : IQPathTile
        {
            //Debug.Log("QPath::FindPath");
            if (world == null || unit == null || startTile == null || endTile == null)
            {
                //Debug.LogError("Null values passed to QPath::FindPath");
                return(null);
            }

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

            resolver.DoWork();

            return(resolver.GetList());
        }
Exemplo n.º 6
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.º 7
0
        public static T[] FindPath <T>(
            IQPathWorld world,
            IQPathUnit unit,
            T startTile,
            T endTile
            ) where T : IQPathTile
        {
            //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 our actual path solver


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

            resolver.DoWork();
            return(resolver.GetList());
        }
Exemplo n.º 8
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());
        }