예제 #1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="WhatPumpkin.SceneInfo"/> class.
		/// I'm using this constructor primarily for receiving save/load data.
		/// </summary>
		/// <param name="key">Key.</param>
		/// <param name="sceneObjects">Scene objects.</param>
		/*
		public SceneInfo(string key, IEnumerable sceneObjects) {
				
			_key = key;

		}*/

		/// <summary>
		/// Initializes a new instance of the <see cref="WhatPumpkin.SceneInfo"/> class.
		/// </summary>
		/// <param name="key">Key.</param>

		public SceneInfo(string key) {
		
			_key = key;

			// TODO: Abstract this data

			foreach (Entity entity in  GameObject.FindObjectsOfType<Entity>()) {
				
				
							ISceneObject<string> item = (ISceneObject<string>)entity;
				
							if (item != null) {
									try {
						
											SceneObject sceneObject = new SceneObject ();

											_sceneObjects.Add (sceneObject);

											sceneObject.ReceiveData(item);
									} catch (System.Exception e) {
											Debug.LogException(e);
									}
							}

			}
		}