private void ProcessMultiWordUserCommand(CommandAndOtherWords commandNounPair, string userText) { Util.Command command = commandNounPair.command; Util.Noun noun = commandNounPair.noun; // Debug.Log(command.ToString()); // Debug.Log(noun.ToString()); string message = ""; switch (command) { case Util.Command.Use: string itemName = userText.Split(' ')[1]; Item item = player.inventory.GetItem(itemName); if (item != null) { message = "You use " + item.Name; message += "\r\n" + item.use(); if (currentLocation.monster != null && !currentLocation.monster.amIDead()) { player.receiveDommage(currentLocation.monster.getAttackPoint()); } break; } message = "You do not posess that item"; break; case Util.Command.Pick: switch (noun) { case Util.Noun.Up: message = "error"; if (currentLocation.pickupables.Count == 0) { message = "There nothing to be picked up."; break; } while (currentLocation.pickupables.Count != 0) { Item pickedup = currentLocation.pickupables[currentLocation.pickupables.Count - 1]; currentLocation.pickupables.RemoveAt(currentLocation.pickupables.Count - 1); Debug.Log(pickedup.Name); player.addItem(pickedup); message = "You picked up " + pickedup.Name; } break; } break; case Util.Command.Unknown: default: message = Util.Message(Util.Type.Unknown); break; } ShowMessage(message); }
private void ProcessMultiWordUserCommand(CommandAndOtherWords commandNounPair) { Util.Command command = commandNounPair.command; Util.Noun noun = commandNounPair.noun; // Debug.Log(command.ToString()); // Debug.Log(noun.ToString()); string message = ""; switch (command) { case Util.Command.Use: switch (noun) { case Util.Noun.Todo_List: Item item = player.inventory.GetItem("todo list"); if (item != null) { message = "Current tasks: " + map.ship.GetStatus(); } else { message = "You do not posess that item"; } break; } break; case Util.Command.Pick: switch (noun) { case Util.Noun.Up: message = "error"; if (currentLocation.pickupables.Count == 0) { message = "There nothing to be picked up."; break; } while (currentLocation.pickupables.Count != 0) { Item pickedup = currentLocation.pickupables[currentLocation.pickupables.Count - 1]; currentLocation.pickupables.RemoveAt(currentLocation.pickupables.Count - 1); Debug.Log(pickedup.name); player.addItem(pickedup); message = "You picked up " + pickedup.name; } break; } break; } ShowMessage(message); }
private void ProcessMultiWordUserCommand(CommandAndOtherWords commandNounPair) { Util.Command command = commandNounPair.command; Util.Noun noun = commandNounPair.noun; string message = ""; switch (command) { case Util.Command.Pick: switch (noun) { case Util.Noun.Up: List <PickUp> pickups = player.GetLocation().pickupables; if (pickups.Count > 0) { // Pick up the first item in the list only. PickUp item = pickups[0]; message = "You picked up: " + item.name + " (" + item.description + ")"; item.Pickup(player); } else { message = "Nothing to pick up."; } break; default: message = Util.Message(Util.Type.Unknown); break; } break; default: message = Util.Message(Util.Type.Unknown); break; } ShowMessage(message); }