-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommand.cs
More file actions
63 lines (56 loc) · 1.71 KB
/
Command.cs
File metadata and controls
63 lines (56 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
namespace Zuul
{
/*
Needs work.. I dont like how it works with command word and second command
word. It is fidgety.. I want more options for commands.
*/
public class Command
{
private string _commandWord;
private string _secondCommandWord;
private string _thirdCommandWord;
/**
* Create a command object. First and second word must be supplied, but
* either one (or both) can be null. The command word should be null to
* indicate that this was a command that is not recognized by this game.
*/
public Command(string firstWord, string secondWord, string thirdWord = null)
{
_commandWord = firstWord;
_secondCommandWord = secondWord;
_thirdCommandWord = thirdWord;
}
/*
Return the command word (the first word) of this command. If the
command was not understoor, the result is null.
*/
public string GetCommandWord()
{
return _commandWord;
}
/*
Returns the second word of this command. Returns null if there was no
second word.
*/
public string GetSecondWord()
{
return _secondCommandWord;
}
public string GetThirdWord()
{
return _thirdCommandWord;
}
public bool IsUnknown() // not known exception is thrown?
{
return _commandWord == null;
}
public bool HasSecondWord()
{
return _secondCommandWord != null;
}
public bool HasThirdWord()
{
return _secondCommandWord != null;
}
}
}