Exemple #1
0
 /// <inheritdoc/>
 public override bool CanTransitionTo(Scene scene)
 {
     if (scene is SongSelectScene)
         return true;
     else
         return false;
 }
Exemple #2
0
 /// <inheritdoc/>
 public override bool CanTransitionTo(Scene scene)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
		/// <summary>
		/// Transitions from the given old scene to the given new scene.
		/// </summary>
		/// <param name="oldScene">The old scene that should be replaced with the new scene.</param>
		/// <param name="newScene">The new scene that should replace the given old scene.</param>
		public void Transition(Scene oldScene, Scene newScene)
		{
			int oldSceneIndex = activeScenes.IndexOf(oldScene);
			if (oldSceneIndex == -1)
				throw new Exception($"Attempted to transition from non-active scene {oldScene.Name} to {newScene.Name}");

			int newSceneIndex = activeScenes.IndexOf(newScene);
			if (newSceneIndex != -1)
				throw new Exception($"Attempted to transition from {oldScene.Name} to already-active scene {newScene.Name}");

			if (!oldScene.CanTransitionTo(newScene))
				throw new Exception($"Attempted invalid transition from {oldScene.Name} to {newScene.Name}");

			Action onTransitionOutFinished = null; // this is necessary due to definite-assignment rules.
			onTransitionOutFinished = () =>
			{
				oldScene.OnExit();
				activeScenes.Remove(oldScene);
				oldScene.TransitionFinished -= onTransitionOutFinished;
			};
			oldScene.TransitionFinished += onTransitionOutFinished;
			oldScene.TransitionOut();

			activeScenes.Add(newScene);
			newScene.TransitionIn();
		}
Exemple #4
0
 /// <inheritdoc/>
 public override bool CanTransitionTo(Scene scene)
 {
     return scene is PlayScene;
 }
Exemple #5
0
 /// <summary>
 /// Returns true if this scene is allowed to transition to the given scene, false otherwise.
 /// </summary>
 /// <param name="scene">The scene that should be transitioned to.</param>
 /// <returns>True if this scene is allowed to transition to the given scene, false otherwise.</returns>
 public abstract bool CanTransitionTo(Scene scene);