Beispiel #1
0
        public override void OnEnter()
        {
            mo = graph.Value as FsmNavGraph;
            if ((mo == null) || (mo.Value == null) || alwaysNew.Value)
            {
                AstarPath.active.astarData.AddGraph(mo.Value);
                g = FsmConverter.GetNavGraph(graph) as PointGraph;
                Debug.Log("Creating New Point Graph");

                graph.Value = FsmConverter.SetNavGraph(g as NavGraph);
            }
            else
            {
                g = FsmConverter.GetNavGraph(graph) as PointGraph;
            }

            DoStuff();
            Finish();
        }
        public override void OnEnter()
        {
            var mo = graph.Value as FsmNavGraph;

            if (mo.Value == null)
            {
                Finish();
                return;
            }             // it would continue for a frame without return

            g = FsmConverter.GetNavGraph(graph);

            DoStuff();

            if (!everyFrame.Value)
            {
                Finish();
            }
        }
        public void DoStuff()
        {
            var go = graph.Value as FsmNavGraph;

            if (go.Value == null)
            {
                Finish();
                return;
            }

            g = FsmConverter.GetNavGraph(graph);

            guid.Value           = g.guid.ToString();
            drawGizmos.Value     = g.drawGizmos;
            infoScreenOpen.Value = g.infoScreenOpen;
            initialPenalty.Value = (int)g.initialPenalty;
            name.Value           = g.name;

            nodes.Value = FsmConverter.SetNodes(FsmConverter.NodeListToArray(g.nodes)) as FsmNodes;              // everywhere else it's saved as a generic list, only here it is an array, so it needs extra conversion
            open.Value  = g.open;

            if (graphType == GraphType.pointGraph && g as PointGraph != null)
            {
                autoLinkNodes.Value      = (g as PointGraph).autoLinkNodes;
                limits.Value             = (g as PointGraph).limits;
                mask.Value               = (g as PointGraph).mask;
                maxDistance.Value        = (g as PointGraph).maxDistance;
                raycast.Value            = (g as PointGraph).raycast;
                recursive.Value          = (g as PointGraph).recursive;
                root.Value               = (g as PointGraph).root.gameObject;
                searchTag.Value          = (g as PointGraph).searchTag;
                thickRaycast.Value       = (g as PointGraph).thickRaycast;
                thickRaycastRadius.Value = (g as PointGraph).thickRaycastRadius;
            }

            if (graphType == GraphType.gridGraph && g as GridGraph != null)
            {
                getNearestForceOverlap.Value = (g as GridGraph).getNearestForceOverlap;
                scans.Value = (g as GridGraph).scans;
                size.Value  = (g as GridGraph).size;
            }
        }
Beispiel #4
0
        public void DoStuff()
        {
            var go = graph.Value as FsmNavGraph;

            if (go.Value == null)
            {
                Finish();
                return;
            }

            g = FsmConverter.GetNavGraph(graph);

            if (!drawGizmos.IsNone)
            {
                g.drawGizmos = drawGizmos.Value;
            }

            if (!infoScreenOpen.IsNone)
            {
                g.infoScreenOpen = infoScreenOpen.Value;
            }

            if (!initialPenalty.IsNone)
            {
                g.initialPenalty = (uint)initialPenalty.Value;
            }

            if (!name.IsNone)
            {
                g.name = name.Value;
            }

            if (!nodes.IsNone)
            {
                g.nodes = FsmConverter.NodeArrayFromList((nodes.Value as FsmNodes).Value);
            }

            if (!open.IsNone)
            {
                g.open = open.Value;
            }

            if (graphType == GraphType.pointGraph && g as PointGraph != null)
            {
                if (!autoLinkNodes.IsNone)
                {
                    (g as PointGraph).autoLinkNodes = autoLinkNodes.Value;
                }

                if (!limits.IsNone)
                {
                    (g as PointGraph).limits = limits.Value;
                }

                if (!mask.IsNone)
                {
                    (g as PointGraph).mask = mask.Value;
                }

                if (!maxDistance.IsNone)
                {
                    (g as PointGraph).maxDistance = maxDistance.Value;
                }

                if (!raycast.IsNone)
                {
                    (g as PointGraph).raycast = raycast.Value;
                }

                if (!recursive.IsNone)
                {
                    (g as PointGraph).recursive = recursive.Value;
                }

                if (!searchTag.IsNone)
                {
                    (g as PointGraph).searchTag = searchTag.Value;
                }

                if (!thickRaycast.IsNone)
                {
                    (g as PointGraph).thickRaycast = thickRaycast.Value;
                }

                if (!thickRaycastRadius.IsNone)
                {
                    (g as PointGraph).thickRaycastRadius = thickRaycastRadius.Value;
                }
            }

            if (graphType == GraphType.gridGraph && g as GridGraph != null)
            {
                if (!getNearestForceOverlap.IsNone)
                {
                    (g as GridGraph).getNearestForceOverlap = getNearestForceOverlap.Value;
                }

                if (!scans.IsNone)
                {
                    (g as GridGraph).scans = scans.Value;
                }

                if (!size.IsNone)
                {
                    (g as GridGraph).size = size.Value;
                }
            }
        }