summaryrefslogtreecommitdiff
path: root/Scripts/Game/CommandParser.cs
blob: 5f8249a3b648b8439a7d0f38c8afef84463caced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System.Linq;
using Godot;
using Texty.Scripts.Commands;

namespace Texty.Scripts.Game
{
    public class CommandParser : Node
    {
        public override void _Ready()
        {
        }

        public Command TryParse(string text)
        {
            var components = text.Split(' ');
            return components[0].ToLower() switch
            {
                "look" => new LookCommand(components.Skip(1).ToArray()),
                _ => null
            };
        }
    }
}