/
Player.cs
82 lines (69 loc) · 1.91 KB
/
Player.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PathFinder
{
class Player
{
World world;
public int x;
public int y;
public List<Rect> rect = new List<Rect>();
public List<Rect> trueRect = new List<Rect>();
int valor = 500;
int _valor = 500;
static Player instance;
Player()
{
x = 0;
y = 0;
}
public static Player Instance
{
get
{
if (instance == null)
{
instance = new Player();
}
return instance;
}
}
Calculator calc;
public void SetPosition()
{
calc = new Calculator();
world = World.Instance;
// world._rect[x][y].name = "Terrain";
for (int i = rect.Count-1; i > 0; i--)
{
for (int j = 0; j <= i - 1; j++)
{
if (rect[j].value > rect[j + 1].value)
{
Rect highValue = rect[j];
rect[j] = rect[j + 1];
rect[j + 1] = highValue;
}
}
}
for (int i = 0; i < rect.Count; i++)
{
world._rect[rect[i].x][rect[i].y].name = "Player";
Console.WriteLine("--------" + rect[i].value + "------");
}
/*for (int i = 0; i <trueRect.Count; i++)
{
world._rect[trueRect[i].x][trueRect[i].y].name = "Player";
}*/
}
public void _SetPosition(Rect r)
{
x = r.x;
y = r.y;
rect.Add(r);
// rect.Add(r);
}
}
}