Ejemplo n.º 1
0
 public void InternalOnPostScan()
 {
     if (this.EndTransform == null || this.StartTransform == null)
     {
         return;
     }
     if (AstarPath.active.astarData.pointGraph == null)
     {
         PointGraph pointGraph = AstarPath.active.astarData.AddGraph(typeof(PointGraph)) as PointGraph;
         pointGraph.name = "PointGraph (used for node links)";
     }
     if (this.startNode != null)
     {
         NodeLink2.reference.Remove(this.startNode);
     }
     if (this.endNode != null)
     {
         NodeLink2.reference.Remove(this.endNode);
     }
     this.startNode      = AstarPath.active.astarData.pointGraph.AddNode((Int3)this.StartTransform.position);
     this.endNode        = AstarPath.active.astarData.pointGraph.AddNode((Int3)this.EndTransform.position);
     this.connectedNode1 = null;
     this.connectedNode2 = null;
     if (this.startNode == null || this.endNode == null)
     {
         this.startNode = null;
         this.endNode   = null;
         return;
     }
     this.postScanCalled = true;
     NodeLink2.reference[this.startNode] = this;
     NodeLink2.reference[this.endNode]   = this;
     this.Apply(true);
 }
Ejemplo n.º 2
0
 public void DrawChildren(PointGraph graph, Transform tr)
 {
     foreach (Transform child in tr) {
         Gizmos.DrawCube (child.position,Vector3.one*HandleUtility.GetHandleSize(child.position)*0.1F);
         if (graph.recursive) DrawChildren (graph, child);
     }
 }
Ejemplo n.º 3
0
        public override void OnDrawGizmos()
        {
            PointGraph graph = target as PointGraph;

            //Debug.Log ("Gizmos "+(graph == null)+" "+target);
            if (graph == null || !graph.active.showNavGraphs)
            {
                return;
            }

            //Handles.color = new Color (0.161F,0.341F,1F,0.5F);
            Gizmos.color = new Color(0.161F, 0.341F, 1F, 0.5F);
            //for (int i=0;i<graph.nodes.Length;i++) {

            if (graph.root != null)
            {
                DrawChildren(graph, graph.root);
            }
            else
            {
                GameObject[] gos = GameObject.FindGameObjectsWithTag(graph.searchTag);
                for (int i = 0; i < gos.Length; i++)
                {
                    Gizmos.DrawCube(gos[i].transform.position, Vector3.one * HandleUtility.GetHandleSize(gos[i].transform.position) * 0.1F);
                }
            }
        }
Ejemplo n.º 4
0
        protected static int CountChildren(Transform tr)
        {
            int         num        = 0;
            IEnumerator enumerator = tr.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object    obj = enumerator.Current;
                    Transform tr2 = (Transform)obj;
                    num++;
                    num += PointGraph.CountChildren(tr2);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            return(num);
        }
Ejemplo n.º 5
0
        /** Updates shortcuts to the first graph of different types.
         * Hard coding references to some graph types is not really a good thing imo. I want to keep it dynamic and flexible.
         * But these references ease the use of the system, so I decided to keep them. It is the only reference to specific graph types in the pathfinding core.\n
         */
        public void UpdateShortcuts()
        {
            navmesh = (NavMeshGraph)FindGraphOfType(typeof(NavMeshGraph));

            gridGraph = (GridGraph)FindGraphOfType(typeof(GridGraph));

            pointGraph = (PointGraph)FindGraphOfType(typeof(PointGraph));
        }
Ejemplo n.º 6
0
 static void DrawChildren(PointGraph graph, Transform tr)
 {
     foreach (Transform child in tr)
     {
         Gizmos.DrawCube(child.position, Vector3.one * UnityEditor.HandleUtility.GetHandleSize(child.position) * 0.1F);
         if (graph.recursive)
         {
             DrawChildren(graph, child);
         }
     }
 }
Ejemplo n.º 7
0
 static void DrawChildren(CommandBuilder draw, PointGraph graph, Transform tr)
 {
     foreach (Transform child in tr)
     {
         draw.SolidBox(child.position, Vector3.one * UnityEditor.HandleUtility.GetHandleSize(child.position) * 0.1F);
         if (graph.recursive)
         {
             DrawChildren(draw, graph, child);
         }
     }
 }
Ejemplo n.º 8
0
        public static int CountChildren(Transform tr)
        {
            int num = 0;

            foreach (Transform tr2 in tr)
            {
                num++;
                num += PointGraph.CountChildren(tr2);
            }
            return(num);
        }
        // Token: 0x060025B7 RID: 9655 RVA: 0x001A1650 File Offset: 0x0019F850
        protected static int CountChildren(Transform tr)
        {
            int num = 0;

            foreach (object obj in tr)
            {
                Transform tr2 = (Transform)obj;
                num++;
                num += PointGraph.CountChildren(tr2);
            }
            return(num);
        }
Ejemplo n.º 10
0
 public void DrawChildren(PointGraph graph, Transform tr)
 {
     foreach (Transform child in tr)
     {
         Gizmos.DrawCube(child.position, Vector3.one * HandleUtility.GetHandleSize(child.position) * 0.1F);
         //Handles.CubeCap (-1,graph.nodes[i].position,Quaternion.identity,HandleUtility.GetHandleSize(graph.nodes[i].position)*0.1F);
         //Gizmos.DrawCube (nodes[i].position,Vector3.one);
         if (graph.recursive)
         {
             DrawChildren(graph, child);
         }
     }
 }
Ejemplo n.º 11
0
        /** Updates shortcuts to the first graph of different types.
         * Hard coding references to some graph types is not really a good thing imo. I want to keep it dynamic and flexible.
         * But these references ease the use of the system, so I decided to keep them. It is the only reference to specific graph types in the pathfinding core.\n
         */
        public void UpdateShortcuts()
        {
            navmesh = (NavMeshGraph)FindGraphOfType(typeof(NavMeshGraph));

#if !ASTAR_NO_GRID_GRAPH
            gridGraph = (GridGraph)FindGraphOfType(typeof(GridGraph));
#endif

#if !ASTAR_NO_POINT_GRAPH
            pointGraph = (PointGraph)FindGraphOfType(typeof(PointGraph));
#endif

            recastGraph = (RecastGraph)FindGraphOfType(typeof(RecastGraph));
        }
Ejemplo n.º 12
0
        private static void CheckNodeLink2(List <Vector3> vectorPath, List <Vector3> funnelPath)
        {
            PointGraph pointGraph = AstarPath.active.astarData.pointGraph;

            if (pointGraph.GetNearest(vectorPath [1]).clampedPosition == vectorPath [1])
            {
                if (vectorPath [1] != funnelPath [1])
                {
                    funnelPath.Insert(1, vectorPath [1]);
                    Debug.Log("CheckNodeLink2: " + vectorPath [1]);
                }

                if (vectorPath [2] != funnelPath [2] && pointGraph.GetNearest(vectorPath [2]).clampedPosition == vectorPath [2])
                {
                    funnelPath.Insert(2, vectorPath [2]);
                    Debug.Log("CheckNodeLink2: " + vectorPath [2]);
                }
            }
        }
Ejemplo n.º 13
0
        public override void OnInspectorGUI(NavGraph target)
        {
            PointGraph graph = target as PointGraph;

            /*
             #if UNITY_3_3
             *              graph.root = (Transform)EditorGUILayout.ObjectField (new GUIContent ("Root","All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"),graph.root,typeof(Transform));
             #else
             *              graph.root = (Transform)EditorGUILayout.ObjectField (new GUIContent ("Root","All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"),graph.root,typeof(Transform),true);
             #endif
             */
            //Debug.Log (EditorGUI.indentLevel);

            graph.root = ObjectField(new GUIContent("Root", "All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"), graph.root, typeof(Transform), true) as Transform;

            graph.recursive = EditorGUILayout.Toggle(new GUIContent("Recursive", "Should childs of the childs in the root GameObject be searched"), graph.recursive);
            graph.searchTag = EditorGUILayout.TagField(new GUIContent("Tag", "If root is not set, all objects with this tag will be used as nodes"), graph.searchTag);

        #if UNITY_4
            if (graph.root != null)
            {
                EditorGUILayout.HelpBox("All childs " + (graph.recursive ? "and sub-childs ":"") + "of 'root' will be used as nodes\nSet root to null to use a tag search instead", MessageType.None);
            }
            else
            {
                EditorGUILayout.HelpBox("All object with the tag '" + graph.searchTag + "' will be used as nodes" + (graph.searchTag == "Untagged" ? "\nNote: the tag 'Untagged' cannot be used" : ""), MessageType.None);
            }
        #else
            if (graph.root != null)
            {
                GUILayout.Label("All childs " + (graph.recursive ? "and sub-childs ":"") + "of 'root' will be used as nodes\nSet root to null to use a tag search instead", AstarPathEditor.helpBox);
            }
            else
            {
                GUILayout.Label("All object with the tag '" + graph.searchTag + "' will be used as nodes" + (graph.searchTag == "Untagged" ? "\nNote: the tag 'Untagged' cannot be used" : ""), AstarPathEditor.helpBox);
            }
        #endif

            graph.maxDistance = EditorGUILayout.FloatField(new GUIContent("Max Distance", "The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxDistance);

        #if UNITY_LE_4_3
            EditorGUIUtility.LookLikeControls();
        #endif
        #if UNITY_4
            graph.limits = EditorGUILayout.Vector3Field("Max Distance (axis aligned)", graph.limits);
        #else
            EditorGUILayoutx.BeginIndent();
            graph.limits = EditorGUILayout.Vector3Field("Max Distance (axis aligned)", graph.limits);
            EditorGUILayoutx.EndIndent();
        #endif
        #if UNITY_LE_4_3
            EditorGUIUtility.LookLikeInspector();
        #endif

            graph.raycast = EditorGUILayout.Toggle(new GUIContent("Raycast", "Use raycasting to check if connections are valid between each pair of nodes"), graph.raycast);

            //EditorGUILayoutx.FadeArea fade = editor.GUILayoutx.BeginFadeArea (graph.raycast,"raycast");
            //if ( fade.Show () ) {
            if (graph.raycast)
            {
                EditorGUI.indentLevel++;

                graph.use2DPhysics = EditorGUILayout.Toggle(new GUIContent("Use 2D Physics", "If enabled, all raycasts will use the Unity 2D Physics API instead of the 3D one."), graph.use2DPhysics);
                graph.thickRaycast = EditorGUILayout.Toggle(new GUIContent("Thick Raycast", "A thick raycast checks along a thick line with radius instead of just along a line"), graph.thickRaycast);

                //editor.GUILayoutx.BeginFadeArea (graph.thickRaycast,"thickRaycast");
                if (graph.thickRaycast)
                {
                    graph.thickRaycastRadius = EditorGUILayout.FloatField(new GUIContent("Raycast Radius", "The radius in world units for the thick raycast"), graph.thickRaycastRadius);
                }
                //editor.GUILayoutx.EndFadeArea ();

                //graph.mask = 1 << EditorGUILayout.LayerField ("Mask",(int)Mathf.Log (graph.mask,2));
                graph.mask = EditorGUILayoutx.LayerMaskField(/*new GUIContent (*/ "Mask" /*,"Used to mask which layers should be checked")*/, graph.mask);
                EditorGUI.indentLevel--;
            }

            //editor.GUILayoutx.EndFadeArea ();
        }
Ejemplo n.º 14
0
		/** Updates shortcuts to the first graph of different types.
		 * Hard coding references to some graph types is not really a good thing imo. I want to keep it dynamic and flexible.
		 * But these references ease the use of the system, so I decided to keep them. It is the only reference to specific graph types in the pathfinding core.\n
		 */
		public void UpdateShortcuts () {
			navmesh = (NavMeshGraph)FindGraphOfType (typeof(NavMeshGraph));
			gridGraph = (GridGraph)FindGraphOfType (typeof(GridGraph));
			pointGraph = (PointGraph)FindGraphOfType (typeof(PointGraph));
			recastGraph = (RecastGraph)FindGraphOfType (typeof(RecastGraph));
		}
Ejemplo n.º 15
0
 public static FsmPointGraphs SetPointGraphs(PointGraph[] gameObject)
 {
     return new FsmPointGraphs()
     {
         Value = gameObject
     };
 }
        // Token: 0x060025BC RID: 9660 RVA: 0x001A17D0 File Offset: 0x0019F9D0
        protected override IEnumerable <Progress> ScanInternal()
        {
            yield return(new Progress(0f, "Searching for GameObjects"));

            if (this.root == null)
            {
                GameObject[] gos = (this.searchTag != null) ? GameObject.FindGameObjectsWithTag(this.searchTag) : null;
                if (gos == null)
                {
                    this.nodes     = new PointNode[0];
                    this.nodeCount = 0;
                    yield break;
                }
                yield return(new Progress(0.1f, "Creating nodes"));

                this.nodeCount = gos.Length;
                this.nodes     = this.CreateNodes(this.nodeCount);
                for (int i = 0; i < gos.Length; i++)
                {
                    this.nodes[i].position   = (Int3)gos[i].transform.position;
                    this.nodes[i].Walkable   = true;
                    this.nodes[i].gameObject = gos[i].gameObject;
                }
                gos = null;
            }
            else
            {
                if (!this.recursive)
                {
                    this.nodeCount = this.root.childCount;
                    this.nodes     = this.CreateNodes(this.nodeCount);
                    int num = 0;
                    using (IEnumerator enumerator = this.root.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            object    obj       = enumerator.Current;
                            Transform transform = (Transform)obj;
                            this.nodes[num].position   = (Int3)transform.position;
                            this.nodes[num].Walkable   = true;
                            this.nodes[num].gameObject = transform.gameObject;
                            num++;
                        }
                        goto IL_24A;
                    }
                }
                this.nodeCount = PointGraph.CountChildren(this.root);
                this.nodes     = this.CreateNodes(this.nodeCount);
                int num2 = 0;
                this.AddChildren(ref num2, this.root);
            }
IL_24A:
            if (this.optimizeForSparseGraph)
            {
                yield return(new Progress(0.15f, "Building node lookup"));

                this.RebuildNodeLookup();
            }
            foreach (Progress progress in this.ConnectNodesAsync())
            {
                yield return(progress.MapTo(0.16f, 1f, null));
            }
            IEnumerator <Progress> enumerator2 = null;

            yield break;
            yield break;
        }
Ejemplo n.º 17
0
        public override IEnumerable <Progress> ScanInternal()
        {
            yield return(new Progress(0f, "Searching for GameObjects"));

            if (this.root == null)
            {
                GameObject[] gos = (this.searchTag == null) ? null : GameObject.FindGameObjectsWithTag(this.searchTag);
                if (gos == null)
                {
                    this.nodes     = new PointNode[0];
                    this.nodeCount = 0;
                    yield break;
                }
                yield return(new Progress(0.1f, "Creating nodes"));

                this.nodes     = new PointNode[gos.Length];
                this.nodeCount = this.nodes.Length;
                for (int j = 0; j < this.nodes.Length; j++)
                {
                    this.nodes[j] = new PointNode(this.active);
                }
                for (int k = 0; k < gos.Length; k++)
                {
                    this.nodes[k].SetPosition((Int3)gos[k].transform.position);
                    this.nodes[k].Walkable   = true;
                    this.nodes[k].gameObject = gos[k].gameObject;
                }
            }
            else if (!this.recursive)
            {
                this.nodes     = new PointNode[this.root.childCount];
                this.nodeCount = this.nodes.Length;
                for (int l = 0; l < this.nodes.Length; l++)
                {
                    this.nodes[l] = new PointNode(this.active);
                }
                int         num        = 0;
                IEnumerator enumerator = this.root.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        object    obj       = enumerator.Current;
                        Transform transform = (Transform)obj;
                        this.nodes[num].SetPosition((Int3)transform.position);
                        this.nodes[num].Walkable   = true;
                        this.nodes[num].gameObject = transform.gameObject;
                        num++;
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            else
            {
                this.nodes     = new PointNode[PointGraph.CountChildren(this.root)];
                this.nodeCount = this.nodes.Length;
                for (int m = 0; m < this.nodes.Length; m++)
                {
                    this.nodes[m] = new PointNode(this.active);
                }
                int num2 = 0;
                this.AddChildren(ref num2, this.root);
            }
            if (this.optimizeForSparseGraph)
            {
                yield return(new Progress(0.15f, "Building node lookup"));

                this.RebuildNodeLookup();
            }
            if (this.maxDistance >= 0f)
            {
                List <PointNode> connections          = new List <PointNode>();
                List <uint>      costs                = new List <uint>();
                List <GraphNode> candidateConnections = new List <GraphNode>();
                long             maxPossibleSqrRange;
                if (this.maxDistance == 0f && (this.limits.x == 0f || this.limits.y == 0f || this.limits.z == 0f))
                {
                    maxPossibleSqrRange = long.MaxValue;
                }
                else
                {
                    maxPossibleSqrRange  = (long)(Mathf.Max(this.limits.x, Mathf.Max(this.limits.y, Mathf.Max(this.limits.z, this.maxDistance))) * 1000f) + 1L;
                    maxPossibleSqrRange *= maxPossibleSqrRange;
                }
                for (int i = 0; i < this.nodes.Length; i++)
                {
                    if (i % 512 == 0)
                    {
                        yield return(new Progress(Mathf.Lerp(0.15f, 1f, (float)i / (float)this.nodes.Length), "Connecting nodes"));
                    }
                    connections.Clear();
                    costs.Clear();
                    PointNode node = this.nodes[i];
                    if (this.optimizeForSparseGraph)
                    {
                        candidateConnections.Clear();
                        this.lookupTree.GetInRange(node.position, maxPossibleSqrRange, candidateConnections);
                        Console.WriteLine(i + " " + candidateConnections.Count);
                        for (int n = 0; n < candidateConnections.Count; n++)
                        {
                            PointNode pointNode = candidateConnections[n] as PointNode;
                            float     num3;
                            if (pointNode != node && this.IsValidConnection(node, pointNode, out num3))
                            {
                                connections.Add(pointNode);
                                costs.Add((uint)Mathf.RoundToInt(num3 * 1000f));
                            }
                        }
                    }
                    else
                    {
                        for (int num4 = 0; num4 < this.nodes.Length; num4++)
                        {
                            if (i != num4)
                            {
                                PointNode pointNode2 = this.nodes[num4];
                                float     num5;
                                if (this.IsValidConnection(node, pointNode2, out num5))
                                {
                                    connections.Add(pointNode2);
                                    costs.Add((uint)Mathf.RoundToInt(num5 * 1000f));
                                }
                            }
                        }
                    }
                    node.connections     = connections.ToArray();
                    node.connectionCosts = costs.ToArray();
                }
            }
            yield break;
        }
        // Use this for initialization
        public override void OnEnter()
        {
            FsmNavGraph go = graph.Value as FsmNavGraph;
            if(go.Value as PointGraph == null) {Finish(); return;}
            g = go.Value as PointGraph;

            DoStuff();

            if (!everyFrame.Value)
            Finish();
        }
Ejemplo n.º 19
0
		/** Updates shortcuts to the first graph of different types.
		 * Hard coding references to some graph types is not really a good thing imo. I want to keep it dynamic and flexible.
		 * But these references ease the use of the system, so I decided to keep them. It is the only reference to specific graph types in the pathfinding core.\n
		 */
		public void UpdateShortcuts () {
			navmesh = (NavMeshGraph)FindGraphOfType (typeof(NavMeshGraph));

#if !ASTAR_NO_GRID_GRAPH
			gridGraph = (GridGraph)FindGraphOfType (typeof(GridGraph));
#endif

#if !ASTAR_NO_POINT_GRAPH
			pointGraph = (PointGraph)FindGraphOfType (typeof(PointGraph));
#endif

			recastGraph = (RecastGraph)FindGraphOfType (typeof(RecastGraph));
		}
        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();
        }
Ejemplo n.º 21
0
 // Token: 0x06000526 RID: 1318 RVA: 0x0002CF88 File Offset: 0x0002B388
 public override void ScanInternal(OnScanStatus statusCallback)
 {
     if (this.root == null)
     {
         GameObject[] array = GameObject.FindGameObjectsWithTag(this.searchTag);
         if (array == null)
         {
             this.nodes     = new PointNode[0];
             this.nodeCount = 0;
             return;
         }
         this.nodes     = new PointNode[array.Length];
         this.nodeCount = this.nodes.Length;
         for (int i = 0; i < this.nodes.Length; i++)
         {
             this.nodes[i] = new PointNode(this.active);
         }
         for (int j = 0; j < array.Length; j++)
         {
             this.nodes[j].SetPosition((Int3)array[j].transform.position);
             this.nodes[j].Walkable   = true;
             this.nodes[j].gameObject = array[j].gameObject;
         }
     }
     else if (!this.recursive)
     {
         this.nodes     = new PointNode[this.root.childCount];
         this.nodeCount = this.nodes.Length;
         for (int k = 0; k < this.nodes.Length; k++)
         {
             this.nodes[k] = new PointNode(this.active);
         }
         int         num        = 0;
         IEnumerator enumerator = this.root.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object    obj       = enumerator.Current;
                 Transform transform = (Transform)obj;
                 this.nodes[num].SetPosition((Int3)transform.position);
                 this.nodes[num].Walkable   = true;
                 this.nodes[num].gameObject = transform.gameObject;
                 num++;
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
     }
     else
     {
         this.nodes     = new PointNode[PointGraph.CountChildren(this.root)];
         this.nodeCount = this.nodes.Length;
         for (int l = 0; l < this.nodes.Length; l++)
         {
             this.nodes[l] = new PointNode(this.active);
         }
         int num2 = 0;
         this.AddChildren(ref num2, this.root);
     }
     if (this.optimizeForSparseGraph)
     {
         this.RebuildNodeLookup();
     }
     if (this.maxDistance >= 0f)
     {
         List <PointNode> list  = new List <PointNode>(3);
         List <uint>      list2 = new List <uint>(3);
         for (int m = 0; m < this.nodes.Length; m++)
         {
             list.Clear();
             list2.Clear();
             PointNode pointNode = this.nodes[m];
             if (this.optimizeForSparseGraph)
             {
                 Int3 lhs  = this.WorldToLookupSpace(pointNode.position);
                 int  num3 = (this.lookupCellSize.y != 0) ? PointGraph.ThreeDNeighbours.Length : 9;
                 for (int n = 0; n < num3; n++)
                 {
                     Int3      key = lhs + PointGraph.ThreeDNeighbours[n];
                     PointNode next;
                     if (this.nodeLookup.TryGetValue(key, out next))
                     {
                         while (next != null)
                         {
                             float num4 = 0f;
                             if (this.IsValidConnection(pointNode, next, out num4))
                             {
                                 list.Add(next);
                                 list2.Add((uint)Mathf.RoundToInt(num4 * 1000f));
                             }
                             next = next.next;
                         }
                     }
                 }
             }
             else
             {
                 for (int num5 = 0; num5 < this.nodes.Length; num5++)
                 {
                     if (m != num5)
                     {
                         PointNode pointNode2 = this.nodes[num5];
                         float     num6       = 0f;
                         if (this.IsValidConnection(pointNode, pointNode2, out num6))
                         {
                             list.Add(pointNode2);
                             list2.Add((uint)Mathf.RoundToInt(num6 * 1000f));
                         }
                     }
                 }
             }
             pointNode.connections     = list.ToArray();
             pointNode.connectionCosts = list2.ToArray();
         }
     }
 }
Ejemplo n.º 22
0
 public static FsmPointGraph SetPointGraph(PointGraph gameObject)
 {
     return new FsmPointGraph()
     {
         Value = gameObject
     };
 }
Ejemplo n.º 23
0
 public void UpdateShortcuts()
 {
     this.gridGraph  = (GridGraph)this.FindGraphOfType(typeof(GridGraph));
     this.pointGraph = (PointGraph)this.FindGraphOfType(typeof(PointGraph));
 }
		public void DrawChildren (PointGraph graph, Transform tr) {
			foreach (Transform child in tr) {
				Gizmos.DrawCube (child.position,Vector3.one*HandleUtility.GetHandleSize(child.position)*0.1F);
				//Handles.CubeCap (-1,graph.nodes[i].position,Quaternion.identity,HandleUtility.GetHandleSize(graph.nodes[i].position)*0.1F);
				//Gizmos.DrawCube (nodes[i].position,Vector3.one);
				if (graph.recursive) DrawChildren (graph, child);
			}
		}
        public override void OnEnter()
        {
            mo = graph.Value as FsmPointGraph;
            //Debug.Log(typeof(mo));
            if ((mo == null) ||(mo.Value == null) || alwaysNew.Value)
            {
                AstarPath.active.astarData.AddGraph(mo.Value);
                g = FsmConverter.GetPointGraph(graph) as PointGraph;
                Debug.Log ("Creating New Point Graph");

                graph.Value = FsmConverter.SetPointGraph(g);
            } // create a PointGraph if the variable does not contain a valid one already.
            else
            { g = FsmConverter.GetPointGraph(graph) as PointGraph; }

            DoStuff();
            Finish();
        }