summaryrefslogtreecommitdiff
path: root/Scripts/CommandParser.cs
blob: 97d8025e9062ad0e94a2c5bd42af17cd06b92af0 (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
{
    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
            };
        }
    }
}