Elin Decompiled Documentation EA 23.102 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 p.cell.bridgeHeight -= (byte)num2;
71 }
72 }
73 else
74 {
75 int num3 = brushRadius - num;
77 {
78 num3 = 1;
79 }
80 if (mode == Mode.Down)
81 {
82 num3 *= -1;
83 }
84 if (p.cell.height + num3 < 0)
85 {
86 num3 = -p.cell.height;
87 }
88 else if (p.cell.height + num3 > EClass.setting.maxGenHeight)
89 {
90 num3 = EClass.setting.maxGenHeight - p.cell.height;
91 }
92 p.cell.height += (byte)num3;
93 if (p.cell._bridge != 0)
94 {
95 p.cell.bridgeHeight += (byte)num3;
96 }
97 }
99 if (p.cell.room != null)
100 {
101 p.cell.room.SetDirty();
102 }
103 });
104 }
105}
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
Room room
Definition: Cell.cs:102
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
void RefreshNeighborTiles()
Definition: Point.cs:1240
int Distance(Point p)
Definition: Point.cs:953
Cell cell
Definition: Point.cs:51