/
PlayerState.cs
38 lines (34 loc) · 1.04 KB
/
PlayerState.cs
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
using System;
using Pirozgok.Commands;
namespace Pirozgok
{
class PlayerState : EngineCommandReceiver
{
public int RowsPoints { get; set; }
public int Combo { get; set; }
public Field Field { get; set; }
public PlayerState(int fieldWidth, int fieldHeight)
{
Field = new Field(fieldWidth, fieldHeight);
RouteCommand<PlayerCommand>(ReceiveCommand);
}
public void ReceiveCommand(PlayerCommand command)
{
switch (command.Key)
{
case "row_points":
RowsPoints = int.Parse(command.Value);
break;
case "combo":
Combo = int.Parse(command.Value);
break;
case "field":
Field.Parse(command.Value);
break;
default:
Console.WriteLine("Invalid player command: {0}", command.Key);
break;
}
}
}
}