diff options
Diffstat (limited to 'Scripts/Game/CommandParser.cs')
| -rw-r--r-- | Scripts/Game/CommandParser.cs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Scripts/Game/CommandParser.cs b/Scripts/Game/CommandParser.cs index 9b02ee5..6c29545 100644 --- a/Scripts/Game/CommandParser.cs +++ b/Scripts/Game/CommandParser.cs @@ -2,22 +2,21 @@ using System.Linq; using Godot; using Texty.Scripts.Commands; -namespace Texty.Scripts.Game +namespace Texty.Scripts.Game; + +public partial class CommandParser : Node { - public partial class CommandParser : Node + public override void _Ready() { - public override void _Ready() - { - } + } - public Command TryParse(string text) + public Command TryParse(string text) + { + var components = text.Split(' '); + return components[0].ToLower() switch { - var components = text.Split(' '); - return components[0].ToLower() switch - { - "look" => new LookCommand(components.Skip(1).ToArray()), - _ => null - }; - } + "look" => new LookCommand(components.Skip(1).ToArray()), + _ => null + }; } }
\ No newline at end of file |
