示例#1
0
 public void GenAstarPath(string snode, string enode, LcCapType captype = LcCapType.anything)
 {
     startnodename = snode;
     endnodename   = enode;
     // Debug.Log("GenAstarPath from " + snode + " to " + enode);
     GenAstarPath(captype);
 }
示例#2
0
        public Path GenAstar(string startnodename, string endnodename, LcCapType captype)
        {
            var gcr  = GetGraphCtrl();
            var path = gcr.GenAstar(startnodename, endnodename, captype);

            return(path);
        }
示例#3
0
        bool CheckForVisibiltyChanges()
        {
            bool chg = (updateCount == 0) ||
                       (oldFilterOnCap != filterOnCap) ||
                       (oldCapFilter != capfilter) ||
                       (oldFilterOnUse != filterOnUse) ||
                       (oldUseFilter != usefilter) ||
                       (oldLinksVisible != linksvisible) ||
                       (oldNodesVisible != nodesvisible);

            if (chg)
            {
                if (filterOnCap && !oldFilterOnCap)
                {
                    filterOnUse = false;
                }
                else if (filterOnUse && !oldFilterOnUse)
                {
                    filterOnCap = false;
                }
                oldLinksVisible = linksvisible;
                oldNodesVisible = nodesvisible;
                oldFilterOnCap  = filterOnCap;
                oldCapFilter    = capfilter;
                oldFilterOnUse  = filterOnUse;
                oldUseFilter    = usefilter;
                sman.RequestRefresh("LinkCloudMan-CheckForVisibiltyChanges");
            }
            return(chg);
        }
示例#4
0
        public static bool CanDoCapFromUse(LcCapType cap, LinkUse use)
        {
            if (cap == LcCapType.anything)
            {
                return(true);
            }
            if (!candodict.ContainsKey(cap))
            {
                return(false);
            }
            var curdict = candodict[cap];
            var rv      = curdict.ContainsKey(use);

            return(rv);
        }
示例#5
0
        public float Cost(LcCapType cap, LinkUse usetyp)
        {
            if (cap == LcCapType.anything)
            {
                return(1);
            }
            if (!candodict.ContainsKey(cap))
            {
                return(-1);
            }
            var curdict = candodict[cap];

            if (curdict.ContainsKey(usetyp))
            {
                return(-1);
            }
            return(curdict[usetyp]);
        }
示例#6
0
 public void GenAstarPath(LcCapType captype = LcCapType.anything)
 {
     if (startnodename == "")
     {
         var sp = sman.linkcloudman.GetNode(0);
         startnodename = sp.name;
     }
     if (endnodename == "")
     {
         var ep = sman.linkcloudman.GetNode(-1); // last point
         endnodename = ep.name;
     }
     path = sman.linkcloudman.GenAstar(startnodename, endnodename, captype);
     if (path == null)
     {
         Debug.LogWarning("A * path was not found for captype " + captype);
         status = PathStatusE.AstarNotFound;
     }
     else
     {
         status = PathStatusE.AstarOk;
         //Debug.Log("A * path length:" + _path.waypts.Count + " len:" + _path.pathLength+" captype:"+captype);
     }
 }