public void OnPlayerLocationChanged(object source, PlayerLocationChangedEventArgs args) { if (args.To != this) { return; } OutputDescription(); }
void PlayerLocationChangedHandler(object sender, PlayerLocationChangedEventArgs args) { //look at the players surroundings automatically //when they enter a new location Player Player = (Player)sender; GameController.InputResponse.AppendFormat("Moving to {0}\n ", args.NewLocation.Name); args.NewLocation.TimesVisited += 1; args.NewLocation.Commands["look"](new ParseTree() { Verb = "look", DirectObject = args.NewLocation.Name, DirectObjectKeyValue = args.NewLocation.KeyValue }); //see if entering the location should change the game state checkTriggers(Player, args); }
void checkTriggers(Player player, PlayerLocationChangedEventArgs args) { if (args.NewLocation.KeyValue == "room201_bathroom") { if (args.NewLocation.TimesVisited == 1) { Controller.ActiveStoryScene = Scene.Bathroom201FirstVisit; Controller.SetGameState("StoryScene"); } else { Controller.ActiveStoryScene = Scene.GameOverBathroom201; Controller.SetGameState("StoryScene"); } } }
private void Game_PlayerLocationChanged(object sender, PlayerLocationChangedEventArgs e) { Console.WriteLine($"{e.PlayerName}'s new location is {e.newLocation}"); }