The base class that serves as a root for all visual objects on the scene, allowing scrolling and more.
Inheritance: ObjectGroup
Esempio n. 1
0
		/// <summary>
		/// Go to a new level.
		/// </summary>
		/// <param name="name">Level name.</param>
		public static void GotoLevel(string name)
		{
			if (!LevelExists(name))
				throw new ArgumentException("Level with such name does not exist!");

			if(CurrentScene != null)
				CurrentScene.OnLevelEnded();

			CurrentScene = Scenes[name];
			CurrentScene.OnLevelStarted();
		}
Esempio n. 2
0
		/// <summary>
		/// Create a new level and add it to the storyboard.
		/// </summary>
		/// <param name="name">Desired level name (must be unique across the game).</param>
		/// <param name="level">Level.</param>
		/// <returns></returns>
		public static void AddLevel(string name, GameScene level)
		{
			if(LevelExists(name))
				throw new ArgumentException("Level with such name already exists!");

			Scenes.Add(name, level);

			if (CurrentScene == null)
			{
				CurrentScene = level;
				level.OnLevelStarted();
			}
		}
Esempio n. 3
0
		/// <summary>
		/// Remove a specific level from storyboard.
		/// </summary>
		/// <param name="name">Level.</param>
		public static void RemoveLevel(string name)
		{
			if (Scenes.ContainsKey(name))
			{
				var scene = Scenes[name];
				if (scene == CurrentScene)
					CurrentScene = null;
				Scenes.Remove(name);
			}
		}