Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
POIMap Class Reference

Classes

class  Cell
 

Public Member Functions

void Init (int _mapSize, int _cellSize)
 
void Reset ()
 
Point GetCenterOfEmptyCell (int tries=100)
 
Cell GetCenterCell (int radius=1)
 
Cell GetEmptyCell ()
 
void ForeachCenterOfEmptyCell (Action< Point > action)
 
void OccyupyPOI (Point p, int radius=0)
 
void OccyupyPOI (int _x, int _z, int radius)
 

Public Attributes

Cell[,] cells
 

Static Public Attributes

static int cellSize
 
static int mapSize
 

Properties

int length [get]
 

Detailed Description

Definition at line 3 of file POIMap.cs.

Member Function Documentation

◆ ForeachCenterOfEmptyCell()

void POIMap.ForeachCenterOfEmptyCell ( Action< Point action)
inline

Definition at line 85 of file POIMap.cs.

86 {
87 for (int i = 1; i < length - 2; i++)
88 {
89 for (int j = 1; j < length - 2; j++)
90 {
91 if (!cells[i, j].occupied)
92 {
93 action(cells[i, j].GetCenter());
94 }
95 }
96 }
97 }
Cell[,] cells
Definition: POIMap.cs:23
int length
Definition: POIMap.cs:25

References cells, and length.

◆ GetCenterCell()

Cell POIMap.GetCenterCell ( int  radius = 1)
inline

Definition at line 65 of file POIMap.cs.

66 {
67 return cells[length / 2 - radius + EClass.rnd(radius * 2), length / 2 - radius + EClass.rnd(radius * 2)];
68 }
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50

References cells, length, and EClass.rnd().

Referenced by Zone.SpawnAltar().

◆ GetCenterOfEmptyCell()

Point POIMap.GetCenterOfEmptyCell ( int  tries = 100)
inline

Definition at line 50 of file POIMap.cs.

51 {
52 new Point();
53 for (int i = 0; i < tries; i++)
54 {
55 int num = EClass.rnd(length - 2) + 1;
56 int num2 = EClass.rnd(length - 2) + 1;
57 if (!cells[num, num2].occupied)
58 {
59 return cells[num, num2].GetCenter();
60 }
61 }
62 return Point.Invalid;
63 }
Point GetCenter()
Definition: POIMap.cs:13
Definition: Point.cs:9
static Point Invalid
Definition: Point.cs:28

References cells, POIMap.Cell.GetCenter(), Point.Invalid, length, and EClass.rnd().

◆ GetEmptyCell()

Cell POIMap.GetEmptyCell ( )
inline

Definition at line 70 of file POIMap.cs.

71 {
72 new Point();
73 for (int i = 0; i < 100; i++)
74 {
75 int num = EClass.rnd(length - 2) + 1;
76 int num2 = EClass.rnd(length - 2) + 1;
77 if (cells[num, num2] == null)
78 {
79 return cells[num, num2];
80 }
81 }
82 return null;
83 }

References cells, length, and EClass.rnd().

◆ Init()

void POIMap.Init ( int  _mapSize,
int  _cellSize 
)
inline

Definition at line 27 of file POIMap.cs.

28 {
29 cellSize = _cellSize;
30 mapSize = _mapSize;
31 cells = new Cell[length, length];
32 Reset();
33 }
Definition: Cell.cs:7
void Reset()
Definition: POIMap.cs:35
static int cellSize
Definition: POIMap.cs:19
static int mapSize
Definition: POIMap.cs:21

References cells, cellSize, length, mapSize, and Reset().

Referenced by BaseMapGen.SetSize().

◆ OccyupyPOI() [1/2]

void POIMap.OccyupyPOI ( int  _x,
int  _z,
int  radius 
)
inline

Definition at line 104 of file POIMap.cs.

105 {
106 int num = _x / cellSize;
107 int num2 = _z / cellSize;
108 cells[num, num2].occupied = true;
109 if (radius <= 0)
110 {
111 return;
112 }
113 for (int i = num - radius; i < num + radius + 1; i++)
114 {
115 if (i < 0 || i >= length)
116 {
117 continue;
118 }
119 for (int j = num2 - radius; j < num2 + radius + 1; j++)
120 {
121 if (j >= 0 && j < length)
122 {
123 cells[i, j].occupied = true;
124 }
125 }
126 }
127 }
bool occupied
Definition: POIMap.cs:11

References cells, cellSize, length, and POIMap.Cell.occupied.

◆ OccyupyPOI() [2/2]

void POIMap.OccyupyPOI ( Point  p,
int  radius = 0 
)
inline

Definition at line 99 of file POIMap.cs.

100 {
101 OccyupyPOI(p.x, p.z, radius);
102 }
void OccyupyPOI(Point p, int radius=0)
Definition: POIMap.cs:99
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39

References OccyupyPOI(), Point.x, and Point.z.

Referenced by OccyupyPOI(), and Zone.SpawnAltar().

◆ Reset()

void POIMap.Reset ( )
inline

Definition at line 35 of file POIMap.cs.

36 {
37 for (int i = 0; i < length; i++)
38 {
39 for (int j = 0; j < length; j++)
40 {
41 cells[i, j] = new Cell
42 {
43 x = i,
44 z = j
45 };
46 }
47 }
48 }

References cells, and length.

Referenced by Init(), MapGen.OnGenerateTerrain(), MapGenDungen.OnGenerateTerrain(), and MapGenRegion.OnGenerateTerrain().

Member Data Documentation

◆ cells

Cell [,] POIMap.cells

◆ cellSize

int POIMap.cellSize
static

Definition at line 19 of file POIMap.cs.

Referenced by POIMap.Cell.GetCenter(), Init(), and OccyupyPOI().

◆ mapSize

int POIMap.mapSize
static

Definition at line 21 of file POIMap.cs.

Referenced by Init(), and BaseMapGen.SetSize().

Property Documentation

◆ length

int POIMap.length
get

The documentation for this class was generated from the following file: