// Attempts to move player avatar to a new location and returns the outcome of the movement - potential location will be updated with the location the player avatar is trying to move to public CommandOutcome MovePlayer(MovementWord command) { // Start with potential location being the same as the current location PotentialLocation = CurrentLocation; // Keep track of where player avatar is moving from UpdateOldLocations(); // See if the command is valid for movement from this location MoveOutcome outcome = locationController.TryMovement(command); string moveMsg; if (outcome.locationID != null && outcome.locationID != "") { // The command attempts to move player avatar to a new location PotentialLocation = outcome.locationID; return(CommandOutcome.FULL); } else if (outcome.messageID != null && outcome.messageID != "") { // The command triggers a message for the player instead of a movement moveMsg = outcome.messageID; } else { // The command doesn't do anything at this location, so show a default message for that command moveMsg = command.DefaultMessageID; } textDisplayController.AddTextToLog(playerMessageController.GetMessage(moveMsg)); return(CommandOutcome.MESSAGE); }
// Determines if the given command triggers movement from the player avatar's current location and returns detials of the movement public MoveOutcome TryMovement(MovementWord command) { return(locationsDict[playerController.CurrentLocation].TryMovement(command, this)); }