/** * giveCommand- given a command, performs some operation such as sending out a text message * to players or displaying information to a player. */ public void giveCommand(string cmd) { // Step 1- Parse the command. string[] cmdArray = cmd.Split(' '); string command = cmdArray[0]; List <string> arguments = new List <string> (); for (int i = 1; i < cmdArray.Length; i++) { arguments.Add(cmdArray[i]); } // Step 2- Send the command args to the proper method. switch (command) { case ("echo"): echo(arguments); break; case ("OOC"): ooc(arguments); break; case ("numPlayers"): transform.parent.FindChild("ChatWindow").GetComponent <ChatWindowScript>().addPlayerMessage(playerManager.numPlayers()); break; case ("listNames"): listNames(); break; case ("health"): health(arguments); break; default: commandNotFound(command); break; } }