Elin Modding Docs Doc
Loading...
Searching...
No Matches
POIMap.cs
1using System;
2
3// Token: 0x0200066D RID: 1645
4public class POIMap
5{
6 // Token: 0x17000D15 RID: 3349
7 // (get) Token: 0x06002E21 RID: 11809 RVA: 0x00103BA5 File Offset: 0x00101DA5
8 public int length
9 {
10 get
11 {
12 return POIMap.mapSize / POIMap.cellSize + 1;
13 }
14 }
15
16 // Token: 0x06002E22 RID: 11810 RVA: 0x00103BB4 File Offset: 0x00101DB4
17 public void Init(int _mapSize, int _cellSize)
18 {
19 POIMap.cellSize = _cellSize;
20 POIMap.mapSize = _mapSize;
21 this.cells = new POIMap.Cell[this.length, this.length];
22 this.Reset();
23 }
24
25 // Token: 0x06002E23 RID: 11811 RVA: 0x00103BE0 File Offset: 0x00101DE0
26 public void Reset()
27 {
28 for (int i = 0; i < this.length; i++)
29 {
30 for (int j = 0; j < this.length; j++)
31 {
32 this.cells[i, j] = new POIMap.Cell
33 {
34 x = i,
35 z = j
36 };
37 }
38 }
39 }
40
41 // Token: 0x06002E24 RID: 11812 RVA: 0x00103C30 File Offset: 0x00101E30
42 public Point GetCenterOfEmptyCell(int tries = 100)
43 {
44 new Point();
45 for (int i = 0; i < tries; i++)
46 {
47 int num = EClass.rnd(this.length - 2) + 1;
48 int num2 = EClass.rnd(this.length - 2) + 1;
49 if (!this.cells[num, num2].occupied)
50 {
51 return this.cells[num, num2].GetCenter();
52 }
53 }
54 return Point.Invalid;
55 }
56
57 // Token: 0x06002E25 RID: 11813 RVA: 0x00103C9B File Offset: 0x00101E9B
58 public POIMap.Cell GetCenterCell(int radius = 1)
59 {
60 return this.cells[this.length / 2 - radius + EClass.rnd(radius * 2), this.length / 2 - radius + EClass.rnd(radius * 2)];
61 }
62
63 // Token: 0x06002E26 RID: 11814 RVA: 0x00103CD0 File Offset: 0x00101ED0
64 public POIMap.Cell GetEmptyCell()
65 {
66 new Point();
67 for (int i = 0; i < 100; i++)
68 {
69 int num = EClass.rnd(this.length - 2) + 1;
70 int num2 = EClass.rnd(this.length - 2) + 1;
71 if (this.cells[num, num2] == null)
72 {
73 return this.cells[num, num2];
74 }
75 }
76 return null;
77 }
78
79 // Token: 0x06002E27 RID: 11815 RVA: 0x00103D30 File Offset: 0x00101F30
80 public void ForeachCenterOfEmptyCell(Action<Point> action)
81 {
82 for (int i = 1; i < this.length - 2; i++)
83 {
84 for (int j = 1; j < this.length - 2; j++)
85 {
86 if (!this.cells[i, j].occupied)
87 {
88 action(this.cells[i, j].GetCenter());
89 }
90 }
91 }
92 }
93
94 // Token: 0x06002E28 RID: 11816 RVA: 0x00103D8F File Offset: 0x00101F8F
95 public void OccyupyPOI(Point p, int radius = 0)
96 {
97 this.OccyupyPOI(p.x, p.z, radius);
98 }
99
100 // Token: 0x06002E29 RID: 11817 RVA: 0x00103DA4 File Offset: 0x00101FA4
101 public void OccyupyPOI(int _x, int _z, int radius)
102 {
103 int num = _x / POIMap.cellSize;
104 int num2 = _z / POIMap.cellSize;
105 this.cells[num, num2].occupied = true;
106 if (radius > 0)
107 {
108 for (int i = num - radius; i < num + radius + 1; i++)
109 {
110 if (i >= 0 && i < this.length)
111 {
112 for (int j = num2 - radius; j < num2 + radius + 1; j++)
113 {
114 if (j >= 0 && j < this.length)
115 {
116 this.cells[i, j].occupied = true;
117 }
118 }
119 }
120 }
121 }
122 }
123
124 // Token: 0x04001A3A RID: 6714
125 public static int cellSize;
126
127 // Token: 0x04001A3B RID: 6715
128 public static int mapSize;
129
130 // Token: 0x04001A3C RID: 6716
131 public POIMap.Cell[,] cells;
132
133 // Token: 0x02000BE0 RID: 3040
134 public class Cell
135 {
136 // Token: 0x060045C5 RID: 17861 RVA: 0x0015F9E8 File Offset: 0x0015DBE8
137 public Point GetCenter()
138 {
139 return new Point(this.x * POIMap.cellSize + POIMap.cellSize / 2, this.z * POIMap.cellSize + POIMap.cellSize / 2).Clamp(false);
140 }
141
142 // Token: 0x04002F71 RID: 12145
143 public int x;
144
145 // Token: 0x04002F72 RID: 12146
146 public int z;
147
148 // Token: 0x04002F73 RID: 12147
149 public bool occupied;
150 }
151}
Definition Point.cs:11