Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
AM_Terrain.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public enum Mode
6 {
8 Up,
9 Down
10 }
11
12 public Mode mode;
13
14 public override int SubMenuModeIndex => (int)mode;
15
16 public override bool FixedPointer => true;
17
18 public override int TopHeight(Point p)
19 {
20 return p.cell.height;
21 }
22
23 public override string OnSetSubMenuButton(int a, UIButton b)
24 {
25 if (a < 3)
26 {
27 return "terrain" + a.ToEnum<Mode>();
28 }
29 return null;
30 }
31
32 public override void OnClickSubMenu(int a)
33 {
34 mode = a.ToEnum<Mode>();
35 }
36
37 public override void OnProcessTiles(Point point, int dir)
38 {
39 if (timer < 0.1f)
40 {
41 return;
42 }
43 if (lastPoint != null)
44 {
45 point = lastPoint;
46 }
47 else
48 {
49 lastPoint = new Point(point);
50 }
51 timer = 0f;
52 Cell cell = point.cell;
53 EClass._map.ForeachSphere(point.x, point.z, brushRadius, delegate(Point p)
54 {
55 int num = p.Distance(point);
56 if (mode == Mode.Flatten)
57 {
58 if (p.cell.IsFloorWater != cell.IsFloorWater)
59 {
60 return;
61 }
62 int num2 = p.cell.height - cell.height;
64 {
65 num2 = ((num2 >= 0) ? Mathf.Clamp(brushRadius - num, 1, num2) : Mathf.Clamp((brushRadius - num) * -1, num2, -1));
66 }
67 p.cell.height -= (byte)num2;
68 if (p.cell._bridge != 0)
69 {
70 if (p.cell.bridgeHeight - num2 < 0)
71 {
72 p.cell.bridgeHeight = 0;
73 }
74 else
75 {
76 p.cell.bridgeHeight -= (byte)num2;
77 }
78 }
79 }
80 else
81 {
82 int num3 = brushRadius - num;
84 {
85 num3 = 1;
86 }
87 if (mode == Mode.Down)
88 {
89 num3 *= -1;
90 }
91 if (p.cell.height + num3 < 0)
92 {
93 num3 = -p.cell.height;
94 }
95 else if (p.cell.height + num3 > EClass.setting.maxGenHeight)
96 {
97 num3 = EClass.setting.maxGenHeight - p.cell.height;
98 }
99 p.cell.height += (byte)num3;
100 if (p.cell._bridge != 0)
101 {
102 if (p.cell.bridgeHeight + num3 < 0)
103 {
104 p.cell.bridgeHeight = 0;
105 }
106 else
107 {
108 p.cell.bridgeHeight += (byte)num3;
109 }
110 }
111 }
112 p.RefreshNeighborTiles();
113 if (p.cell.room != null)
114 {
115 p.cell.room.SetDirty();
116 }
117 });
118 }
119}
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
override int TopHeight(Point p)
Definition: AM_Terrain.cs:18
override int SubMenuModeIndex
Definition: AM_Terrain.cs:14
override void OnProcessTiles(Point point, int dir)
Definition: AM_Terrain.cs:37
Mode mode
Definition: AM_Terrain.cs:12
override string OnSetSubMenuButton(int a, UIButton b)
Definition: AM_Terrain.cs:23
override void OnClickSubMenu(int a)
Definition: AM_Terrain.cs:32
override bool FixedPointer
Definition: AM_Terrain.cs:16
int brushRadius
Definition: ActionMode.cs:99
Definition: Cell.cs:7
byte _bridge
Definition: Cell.cs:46
byte height
Definition: Cell.cs:72
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
static GameSetting setting
Definition: EClass.cs:34
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:261
int maxGenHeight
Definition: GameSetting.cs:331
void ForeachSphere(int _x, int _z, float r, Action< Point > action)
Definition: Map.cs:2358
Definition: Point.cs:9
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
int Distance(Point p)
Definition: Point.cs:965
Cell cell
Definition: Point.cs:51