コード例 #1
0
ファイル: AstarData.cs プロジェクト: henryj41043/TheUnseen
		/** Deserializes common info additively
		 * Common info is what is shared between the editor serialization and the runtime serializer.
		 * This is mostly everything except the graph inspectors which serialize some extra data in the editor
		 */
		public void DeserializeGraphsPartAdditive (Pathfinding.Serialization.AstarSerializer sr) {
			if (graphs == null) graphs = new NavGraph[0];
			if (userConnections == null) userConnections = new UserConnection[0];
			
			List<NavGraph> gr = new List<NavGraph>(graphs);
			gr.AddRange (sr.DeserializeGraphs ());
			graphs = gr.ToArray();
			if ( graphs != null ) for ( int i = 0; i<graphs.Length;i++ ) if ( graphs[i] != null ) graphs[i].graphIndex = (uint)i;
			
			List<UserConnection> conns = new List<UserConnection>(userConnections);
			conns.AddRange (sr.DeserializeUserConnections());
			userConnections = conns.ToArray ();
			sr.DeserializeNodes();
			
			//Assign correct graph indices. Issue #21
			for (int i=0;i<graphs.Length;i++) {
				if (graphs[i] == null) continue;
				graphs[i].GetNodes (delegate (GraphNode node) {
					//GraphNode[] nodes = graphs[i].nodes;
					node.GraphIndex = (uint)i;
					return true;
				});
			}
			
			sr.DeserializeExtraInfo();
			sr.PostDeserialization();
			
			for (int i=0;i<graphs.Length;i++) {
				for (int j=i+1;j<graphs.Length;j++) {
					if (graphs[i] != null && graphs[j] != null && graphs[i].guid == graphs[j].guid) {
						Debug.LogWarning ("Guid Conflict when importing graphs additively. Imported graph will get a new Guid.\nThis message is (relatively) harmless.");
						graphs[i].guid = Pathfinding.Util.Guid.NewGuid ();
						break;
					}
				}
			}
		}
コード例 #2
0
ファイル: AstarData.cs プロジェクト: rmkeezer/fpsgame
        /** Deserializes common info additively
         * Common info is what is shared between the editor serialization and the runtime serializer.
         * This is mostly everything except the graph inspectors which serialize some extra data in the editor
         */
        public void DeserializeGraphsPartAdditive(Pathfinding.Serialize.AstarSerializer sr)
        {
            if (graphs == null) graphs = new NavGraph[0];
            if (userConnections == null) userConnections = new UserConnection[0];

            List<NavGraph> gr = new List<NavGraph>(graphs);
            gr.AddRange (sr.DeserializeGraphs ());
            graphs = gr.ToArray();

            List<UserConnection> conns = new List<UserConnection>(userConnections);
            conns.AddRange (sr.DeserializeUserConnections());
            userConnections = conns.ToArray ();
            sr.DeserializeNodes();
            sr.DeserializeExtraInfo();
            sr.PostDeserialization();
        }
コード例 #3
0
ファイル: AstarData.cs プロジェクト: henryj41043/TheUnseen
		/** Deserializes common info.
		 * Common info is what is shared between the editor serialization and the runtime serializer.
		 * This is mostly everything except the graph inspectors which serialize some extra data in the editor
		 */
		public void DeserializeGraphsPart (Pathfinding.Serialization.AstarSerializer sr) {
			ClearGraphs ();
			graphs = sr.DeserializeGraphs ();
			if ( graphs != null ) for ( int i = 0; i<graphs.Length;i++ ) if ( graphs[i] != null ) graphs[i].graphIndex = (uint)i;
			
			userConnections = sr.DeserializeUserConnections();
			//sr.DeserializeNodes();
			sr.DeserializeExtraInfo();
			sr.PostDeserialization();
		}
コード例 #4
0
ファイル: AstarData.cs プロジェクト: rmkeezer/fpsgame
 /** Deserializes common info.
  * Common info is what is shared between the editor serialization and the runtime serializer.
  * This is mostly everything except the graph inspectors which serialize some extra data in the editor
  */
 public void DeserializeGraphsPart(Pathfinding.Serialize.AstarSerializer sr)
 {
     graphs = sr.DeserializeGraphs ();
     userConnections = sr.DeserializeUserConnections();
     sr.DeserializeNodes();
     sr.DeserializeExtraInfo();
     sr.PostDeserialization();
 }
コード例 #5
0
ファイル: AstarData.cs プロジェクト: TimEckhoff/GGJ13_Chill
        /** Deserializes common info additively
         * Common info is what is shared between the editor serialization and the runtime serializer.
         * This is mostly everything except the graph inspectors which serialize some extra data in the editor
         */
        public void DeserializeGraphsPartAdditive(Pathfinding.Serialization.AstarSerializer sr)
        {
            if (graphs == null) graphs = new NavGraph[0];
            if (userConnections == null) userConnections = new UserConnection[0];

            List<NavGraph> gr = new List<NavGraph>(graphs);
            gr.AddRange (sr.DeserializeGraphs ());
            graphs = gr.ToArray();

            List<UserConnection> conns = new List<UserConnection>(userConnections);
            conns.AddRange (sr.DeserializeUserConnections());
            userConnections = conns.ToArray ();
            sr.DeserializeNodes();
            sr.DeserializeExtraInfo();
            sr.PostDeserialization();

            for (int i=0;i<graphs.Length;i++) {
                for (int j=i+1;j<graphs.Length;j++) {
                    if (graphs[i].guid == graphs[j].guid) {
                        Debug.LogWarning ("Guid Conflict when importing graphs additively. Imported graph will get a new Guid.\nThis message is (relatively) harmless.");
                        graphs[i].guid = Pathfinding.Util.Guid.NewGuid ();
                        break;
                    }
                }
            }
        }
コード例 #6
0
		/** Deserializes common info additively
		 * Common info is what is shared between the editor serialization and the runtime serializer.
		 * This is mostly everything except the graph inspectors which serialize some extra data in the editor
		 */
		public void DeserializeGraphsPartAdditive (Pathfinding.Serialization.AstarSerializer sr) {
			if (graphs == null) graphs = new NavGraph[0];
			
			var gr = new List<NavGraph>(graphs);

			// Set an offset so that the deserializer will load
			// the graphs with the correct graph indexes
			sr.SetGraphIndexOffset (gr.Count);

			gr.AddRange (sr.DeserializeGraphs ());
			graphs = gr.ToArray();
			
			//Assign correct graph indices. Issue #21
			for (int i=0;i<graphs.Length;i++) {
				if (graphs[i] == null) continue;
				graphs[i].GetNodes (node => {
					node.GraphIndex = (uint)i;
					return true;
				});
			}
			
			sr.DeserializeExtraInfo();
			sr.PostDeserialization();
			
			for (int i=0;i<graphs.Length;i++) {
				for (int j=i+1;j<graphs.Length;j++) {
					if (graphs[i] != null && graphs[j] != null && graphs[i].guid == graphs[j].guid) {
						Debug.LogWarning ("Guid Conflict when importing graphs additively. Imported graph will get a new Guid.\nThis message is (relatively) harmless.");
						graphs[i].guid = Pathfinding.Util.Guid.NewGuid ();
						break;
					}
				}
			}
		}
コード例 #7
0
		/** Deserializes common info.
		 * Common info is what is shared between the editor serialization and the runtime serializer.
		 * This is mostly everything except the graph inspectors which serialize some extra data in the editor
		 */
		public void DeserializeGraphsPart (Pathfinding.Serialization.AstarSerializer sr) {
			ClearGraphs ();
			graphs = sr.DeserializeGraphs ();

			sr.DeserializeExtraInfo();

			//Assign correct graph indices.
			for (int i=0;i<graphs.Length;i++) {
				if (graphs[i] == null) continue;
				graphs[i].GetNodes (node => {
					node.GraphIndex = (uint)i;
					return true;
				});
			}

			sr.PostDeserialization();
		}
コード例 #8
0
ファイル: AstarData.cs プロジェクト: GeorgiKabadzhov/Gamez
		/** Deserializes common info.
		 * Common info is what is shared between the editor serialization and the runtime serializer.
		 * This is mostly everything except the graph inspectors which serialize some extra data in the editor
		 */
		public void DeserializeGraphsPart (Pathfinding.Serialization.AstarSerializer sr) {
			ClearGraphs ();
			graphs = sr.DeserializeGraphs ();
			if ( graphs != null ) for ( int i = 0; i<graphs.Length;i++ ) if ( graphs[i] != null ) graphs[i].graphIndex = (uint)i;
			
			userConnections = sr.DeserializeUserConnections();
			//sr.DeserializeNodes();
			sr.DeserializeExtraInfo();

			//Assign correct graph indices.
			for (int i=0;i<graphs.Length;i++) {
				if (graphs[i] == null) continue;
				graphs[i].GetNodes (delegate (GraphNode node) {
					node.GraphIndex = (uint)i;
					return true;
				});
			}

			sr.PostDeserialization();
		}