コード例 #1
0
        //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());
        }
コード例 #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());
        }
コード例 #3
0
ファイル: QPath_AStar.cs プロジェクト: cyv-cg/FE
        public QPath_AStar(IQPathUnit unit, T startTile, T endTile, CostEstimateDelegate costEstimateFunc)
        {
            this.unit      = unit;
            this.startTile = startTile;
            this.endTile   = endTile;

            this.costEstimateFunc = costEstimateFunc;
        }
コード例 #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;
 }
コード例 #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;
 }
コード例 #7
0
ファイル: QPath_AStar.cs プロジェクト: tnargy/MyCiv
        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?
        }
コード例 #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;
 }
コード例 #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;
 }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #15
0
ファイル: QPath.cs プロジェクト: TinyHydraBV/4x-Exploration
        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());
        }