static void Main(string[] args) { var heroes = new List <Hero> { new Hero("Max"), new Hero("AlexDarkStalker98"), new Hero("Gaben") }; var party = new Party(heroes); var narrator = new Narrator(); party.AddNarrator(narrator); narrator.AddParty(party); var startingScene = SceneFactory.LoadSampleStory(); var currentScene = startingScene; Console.WriteLine(Game.WelcomeMessage); while (true) { bool chosenPath = true; narrator.Interact(currentScene); if (currentScene.SceneType == SceneType.Choice) { Console.WriteLine("1) " + currentScene.SuccessPathDescription + "\n"); Console.WriteLine("2) " + currentScene.FailurePathDescription + "\n"); party.DisplayPartyInfo(); //party.Interact(currentScene); chosenPath = GetUserChoice(); } try { currentScene = currentScene.GetNextScene(chosenPath); } catch (SceneException) { break; } } switch (currentScene.SceneType) { case SceneType.GoodEnding: narrator.Say(Narrator.GoodEndingSpeech); break; case SceneType.BadEnding: narrator.Say(Narrator.BadEndingSpeech); break; } Console.WriteLine(Game.GameOverMessage); // so that console won't disappear Console.ReadKey(); }
public void AddNarrator(Narrator narrator) { narrator.GameEvent += OnGameEvent; }