Example #1
0
        public void Parse(string command)
        {
            var commands = command.Split(' ');

            switch (commands[0].ToLower())
            {
            case "attack":
            case "a":
                var target = commands.Length > 1 ? commands[1] : string.Empty;
                Attack?.Invoke(target);
                break;

            case "east":
            case "e":
                East?.Invoke();
                break;

            case "help":
                Help?.Invoke();
                break;

            case "north":
            case "n":
                North?.Invoke();
                break;

            case "run":
                Run?.Invoke();
                break;

            case "south":
            case "s":
                South?.Invoke();
                break;

            case "west":
            case "w":
                West?.Invoke();
                break;

            default:
                Unknown?.Invoke();
                break;
            }
        }