using System; namespace STVrogue.GameLogic { [Serializable()] public enum CommandType { DoNOTHING, MOVE, ATTACK, PICKUP, USE, FLEE } /// /// Representing a player command/action. /// [Serializable()] public class Command { CommandType name; /// /// Some commands have arguments. For example, "USE" should specify which item to use, /// and "ATTACK" should specify which monster to attack. The item/room/monster targeted by /// the command is specified through their unique ID. It is essential that you use the /// ID to allow series of commands to be saved. /// string[] args; public Command(CommandType name, params string[] args) { this.name = name; this.args = args; } public CommandType Name => name; public string[] Args => args; public override string ToString() { String o = "" + name; if (args != null && args.Length > 0) { o += "("; for (int i = 0; i < args.Length; i++) { if (i > 0) o += ","; o += args[i]; } o += ")"; } return o; } } }