-
Notifications
You must be signed in to change notification settings - Fork 0
/
WallPointsManager.cs
56 lines (54 loc) · 1.7 KB
/
WallPointsManager.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.Collections.Generic;
namespace Snake
{
static class WallPointsManager
{
static int width, height;
static List<WallPoint> dictionary = new List<WallPoint>();
public static int Width { get => width; set => width = value; }
public static int Height { get => height; set => height = value; }
public static void AddInList(WallPoint thisObject)
{
dictionary.Add(thisObject);
}
public static void BuildSceneWalls(int x0,int y0, int width,int height)
{
Width = width;
Height = height;
for(int x = x0;x < x0 + width ; x++ )
{
WallPoint wallPoint = new WallPoint(x, y0);
}
for (int y = y0; y < y0 + height; y++)
{
WallPoint wallPoint = new WallPoint(x0, y);
}
for (int x = x0; x < x0 + width; x++)
{
WallPoint wallPoint = new WallPoint(x, y0 + height - 1);
}
for (int y = y0; y < y0 + height; y++)
{
WallPoint wallPoint = new WallPoint(x0 + width - 1, y);
}
}
public static void ShowSceneWalls()
{
foreach (WallPoint value in dictionary)
{
value.ShowPoint();
}
}
public static bool CheckedList(int x, int y)
{
foreach (WallPoint value in dictionary)
{
if(value.X == x && value.Y == y)
{
return true;
}
}
return false;
}
}
}