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

namespace Texty.Scripts.Game;

public partial 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
        };
    }
}