-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFruit.cs
40 lines (35 loc) · 838 Bytes
/
Fruit.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
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Snake
{
class Fruit : IDrawable
{
private GameField _gameField;
private int _x;
public int X { get { return _x; } }
private int _y;
public int Y { get { return _y; } }
public Fruit(int aX, int aY)
{
_x = aX;
_y = aY;
}
public void SetField(GameField aGameField)
{
_gameField = aGameField;
}
public void ResetPosition(int aX, int aY)
{
_x = aX;
_y = aY;
}
public void Draw()
{
_gameField.Field[_y][_x].Val = "@";
_gameField.Field[_y][_x].Color = ConsoleColor.Yellow;
}
}
}