Elin Modding Docs Doc
Loading...
Searching...
No Matches
AI_Trolley.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200020B RID: 523
6public class AI_Trolley : AIAct
7{
8 // Token: 0x170003D6 RID: 982
9 // (get) Token: 0x06000EEC RID: 3820 RVA: 0x0006E7B1 File Offset: 0x0006C9B1
10 public int dir
11 {
12 get
13 {
14 return this.trolley.owner.dir;
15 }
16 }
17
18 // Token: 0x06000EED RID: 3821 RVA: 0x0006E7C3 File Offset: 0x0006C9C3
19 public override bool CanManualCancel()
20 {
21 return true;
22 }
23
24 // Token: 0x170003D7 RID: 983
25 // (get) Token: 0x06000EEE RID: 3822 RVA: 0x0006E7C6 File Offset: 0x0006C9C6
26 public override bool CancelWhenDamaged
27 {
28 get
29 {
30 return this.owner != null && (!this.owner.IsPC || this.owner.hp < this.owner.MaxHP / 3);
31 }
32 }
33
34 // Token: 0x170003D8 RID: 984
35 // (get) Token: 0x06000EEF RID: 3823 RVA: 0x0006E7FB File Offset: 0x0006C9FB
36 public override bool CancelWhenMoved
37 {
38 get
39 {
40 return true;
41 }
42 }
43
44 // Token: 0x170003D9 RID: 985
45 // (get) Token: 0x06000EF0 RID: 3824 RVA: 0x0006E7FE File Offset: 0x0006C9FE
46 public override bool ShowCursor
47 {
48 get
49 {
50 return false;
51 }
52 }
53
54 // Token: 0x06000EF1 RID: 3825 RVA: 0x0006E801 File Offset: 0x0006CA01
55 public override IEnumerable<AIAct.Status> Run()
56 {
57 this.owner.Say("ride", this.owner, this.trolley.owner, null, null);
58 if (!this.trolley.HideChara)
59 {
60 this.owner.Talk("ride2", null, null, false);
61 }
62 for (;;)
63 {
64 int nextDir = this.GetNextDir();
65 if (!this.trolley.owner.ExistsOnMap || nextDir == -1)
66 {
67 yield return this.Stop(null);
68 }
69 this.trolley.owner.dir = nextDir;
70 Point point = this.GetPoint(this.dir, true);
71 this.owner.SetDir(nextDir);
72 this.owner.PlayAnime(AnimeID.Truck, false);
73 string idSound = this.trolley.GetIdSound();
74 if (this.owner.IsPC)
75 {
76 this.owner.PlaySound(idSound, 1f, true);
77 }
78 else if (!(EClass.pc.ai is AI_Trolley))
79 {
80 this.owner.PlaySound(idSound, 1f, true);
81 EClass.Sound.Stop(idSound, Mathf.Max(1f, this.trolley.FadeDuration));
82 }
83 foreach (Chara t in point.ListCharas())
84 {
85 this.owner.Kick(t, true, false);
86 }
87 EClass._map.MoveCard(point, this.owner);
88 this.trolley.owner.MoveImmediate(point, true, true);
89 this.trolley.owner.PlayAnime(AnimeID.Truck, false);
90 this.running = true;
91 yield return base.KeepRunning();
92 }
93 yield break;
94 }
95
96 // Token: 0x06000EF2 RID: 3826 RVA: 0x0006E814 File Offset: 0x0006CA14
97 public Point GetPoint(int d, bool onlyValid = true)
98 {
99 Point point = new Point();
100 Point pos = this.trolley.owner.pos;
101 point.Set(pos.x + AI_Trolley.VecList[d].x, pos.z + AI_Trolley.VecList[d].y);
102 if (!point.IsValid || !point.IsInBounds || !point.HasRail || point.IsBlocked)
103 {
104 return null;
105 }
106 using (List<Thing>.Enumerator enumerator = point.Things.GetEnumerator())
107 {
108 while (enumerator.MoveNext())
109 {
110 if (!enumerator.Current.IsMultisize)
111 {
112 return null;
113 }
114 }
115 }
116 if (EClass.pc.pos.Equals(point))
117 {
118 return null;
119 }
120 return point;
121 }
122
123 // Token: 0x06000EF3 RID: 3827 RVA: 0x0006E8F0 File Offset: 0x0006CAF0
124 public int GetNextDir()
125 {
126 int[] array = AI_Trolley.DirList[this.dir];
127 for (int i = 0; i < 3 + (this.running ? 0 : 1); i++)
128 {
129 int num = array[i];
130 if (this.GetPoint(num, true) != null)
131 {
132 return num;
133 }
134 }
135 return -1;
136 }
137
138 // Token: 0x06000EF4 RID: 3828 RVA: 0x0006E934 File Offset: 0x0006CB34
139 public AIAct.Status Stop(Action action = null)
140 {
141 EClass.Sound.Stop(this.trolley.GetIdSound(), this.trolley.FadeDuration);
142 if (this.owner != null)
143 {
144 this.owner.Say("ride_unride", this.owner, this.trolley.owner, null, null);
145 }
146 return base.Success(null);
147 }
148
149 // Token: 0x06000EF5 RID: 3829 RVA: 0x0006E993 File Offset: 0x0006CB93
150 public override void OnCancel()
151 {
152 this.Stop(null);
153 }
154
155 // Token: 0x04000D6B RID: 3435
156 public static int[][] DirList = new int[][]
157 {
158 new int[]
159 {
160 0,
161 1,
162 3,
163 2
164 },
165 new int[]
166 {
167 1,
168 0,
169 2,
170 3
171 },
172 new int[]
173 {
174 2,
175 1,
176 3,
177 0
178 },
179 new int[]
180 {
181 3,
182 2,
183 0,
184 1
185 }
186 };
187
188 // Token: 0x04000D6C RID: 3436
189 public static Vector2Int[] VecList = new Vector2Int[]
190 {
191 new Vector2Int(0, -1),
192 new Vector2Int(1, 0),
193 new Vector2Int(0, 1),
194 new Vector2Int(-1, 0)
195 };
196
197 // Token: 0x04000D6D RID: 3437
198 public TraitTrolley trolley;
199
200 // Token: 0x04000D6E RID: 3438
201 public bool running;
202}
Definition AIAct.cs:7
Definition Chara.cs:12
Definition Point.cs:11