Elin Modding Docs Doc
Loading...
Searching...
No Matches
TCExtra.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200017A RID: 378
6public class TCExtra : TC
7{
8 // Token: 0x170002BE RID: 702
9 // (get) Token: 0x06000AFC RID: 2812 RVA: 0x00044149 File Offset: 0x00042349
10 public override Vector3 FixPos
11 {
12 get
13 {
14 return this.fixPos;
15 }
16 }
17
18 // Token: 0x06000AFD RID: 2813 RVA: 0x00044151 File Offset: 0x00042351
19 private void Awake()
20 {
21 this.originalScale = base.transform.localScale;
22 this.originalAngle = base.transform.localEulerAngles;
23 }
24
25 // Token: 0x06000AFE RID: 2814 RVA: 0x00044178 File Offset: 0x00042378
26 public override void OnDraw(ref Vector3 pos)
27 {
28 if (this._mat != base.owner.material)
29 {
30 this._mat = base.owner.material;
31 this.RefreshColor();
32 }
33 RenderData data = base.owner.renderer.data;
34 bool flag = base.owner.dir == 2 || base.owner.dir == 3;
35 bool flag2 = base.owner.parent is Chara && (base.owner.parent as Chara).held == base.owner;
36 bool flag3 = base.owner.dir % 2 == 1;
37 bool flag4 = (this.alwaysFlip || !flag2) && flag3;
38 if (flag && this.flipBack)
39 {
40 flag4 = !flag4;
41 }
42 bool flag5 = this.useOffsetBack && data.useOffsetBack && flag;
43 if (this.dirPos.Length == 0)
44 {
45 this.v.x = base.owner.renderer.position.x + (flag5 ? data.offsetBack.x : data.offset.x) * (float)(flag4 ? -1 : 1) + this.FixPos.x + this.flipFixX * (float)(flag4 ? -1 : 1) + (flag2 ? (flag3 ? this.heldPosFlip.x : this.heldPos.x) : 0f);
46 this.v.y = base.owner.renderer.position.y + (flag5 ? data.offsetBack.y : data.offset.y) + this.FixPos.y + (flag2 ? (flag3 ? this.heldPosFlip.y : this.heldPos.y) : 0f);
47 this.v.z = base.owner.renderer.position.z + (flag5 ? data.offsetBack.z : data.offset.z) + this.FixPos.z + (flag2 ? -0.5f : 0f) + (flag2 ? (flag3 ? this.heldPosFlip.z : this.heldPos.z) : 0f);
48 }
49 else
50 {
51 this.v.x = base.owner.renderer.position.x + (flag5 ? data.offsetBack.x : data.offset.x) + this.dirPos[base.owner.dir % this.dirPos.Length].x + (flag2 ? (flag3 ? this.heldPosFlip.x : this.heldPos.x) : 0f);
52 this.v.y = base.owner.renderer.position.y + (flag5 ? data.offsetBack.y : data.offset.y) + this.dirPos[base.owner.dir % this.dirPos.Length].y + (flag2 ? (flag3 ? this.heldPosFlip.y : this.heldPos.y) : 0f);
53 this.v.z = base.owner.renderer.position.z + (flag5 ? data.offsetBack.z : data.offset.z) + this.dirPos[base.owner.dir % this.dirPos.Length].z + (flag2 ? -0.5f : 0f) + (flag2 ? (flag3 ? this.heldPosFlip.z : this.heldPos.z) : 0f);
54 }
55 base.transform.position = this.v;
56 if (this.flipSR && this.sr.flipX != flag4)
57 {
58 this.sr.flipX = flag4;
59 }
60 if (this.flipSelf)
61 {
62 base.transform.localScale = (flag4 ? new Vector3(this.originalScale.x * -1f, this.originalScale.y, this.originalScale.z) : this.originalScale);
63 base.transform.localEulerAngles = (flag4 ? new Vector3(this.originalAngle.x * -1f, this.originalAngle.y, this.originalAngle.z) : this.originalAngle);
64 }
65 bool flag6 = (!this.onlyInstalled || base.owner.IsInstalled || base.owner.isRoofItem) && base.owner.trait.UseExtra;
66 TCExtra.Type type = this.type;
67 if (type != TCExtra.Type.Effect)
68 {
69 if (type != TCExtra.Type.QuestBoard)
70 {
71 goto IL_5CE;
72 }
73 flag6 = false;
74 using (List<Quest>.Enumerator enumerator = EMono.game.quests.globalList.GetEnumerator())
75 {
76 while (enumerator.MoveNext())
77 {
78 Quest quest = enumerator.Current;
79 if (quest.IsVisibleOnQuestBoard() && quest.isNew)
80 {
81 flag6 = true;
82 }
83 }
84 goto IL_5CE;
85 }
86 }
87 if (flag6)
88 {
89 TraitEffect traitEffect = base.owner.trait as TraitEffect;
90 if (traitEffect.timer < Time.realtimeSinceStartup)
91 {
92 traitEffect.timer = Time.realtimeSinceStartup - Time.realtimeSinceStartup % traitEffect.Interval + traitEffect.Interval + traitEffect.data.delay;
93 traitEffect.Proc(this.v);
94 }
95 }
96 IL_5CE:
97 if (this.hack == TCExtra.Hack.Candle)
98 {
99 foreach (Transform transform in this.listTrans)
100 {
101 if (flag4)
102 {
103 if (transform.localPosition.z > 0f)
104 {
105 transform.localPosition = transform.localPosition.SetZ(-transform.localPosition.z);
106 }
107 }
108 else if (transform.localPosition.z < 0f)
109 {
110 transform.localPosition = transform.localPosition.SetZ(-transform.localPosition.z);
111 }
112 }
113 }
114 if (base.owner.isHidden && base.owner.isChara && !EMono.pc.CanSee(base.owner.Chara))
115 {
116 flag6 = false;
117 }
118 if (base.gameObject.activeSelf != flag6)
119 {
120 base.gameObject.SetActive(flag6);
121 }
122 }
123
124 // Token: 0x06000AFF RID: 2815 RVA: 0x00044850 File Offset: 0x00042A50
125 public override void OnSetOwner()
126 {
127 base.OnSetOwner();
128 this.RefreshColor();
129 }
130
131 // Token: 0x06000B00 RID: 2816 RVA: 0x00044860 File Offset: 0x00042A60
132 public void RefreshColor()
133 {
134 if (this.sr)
135 {
136 Color color = base.owner.trait.ColorExtra ?? Color.white;
137 color.a = this.sr.color.a;
138 this.sr.color = color;
139 }
140 if (this.colorParticle)
141 {
142 ParticleSystem[] componentsInChildren = base.GetComponentsInChildren<ParticleSystem>();
143 for (int i = 0; i < componentsInChildren.Length; i++)
144 {
145 ParticleSystem.MainModule main = componentsInChildren[i].main;
146 main.startColor = (base.owner.isDyed ? base.owner.DyeMat : base.owner.material).GetColor().SetAlpha(main.startColor.color.a);
147 }
148 }
149 }
150
151 // Token: 0x040009FF RID: 2559
152 public TCExtra.Type type;
153
154 // Token: 0x04000A00 RID: 2560
155 public TCExtra.Hack hack;
156
157 // Token: 0x04000A01 RID: 2561
158 public Vector3 fixPos;
159
160 // Token: 0x04000A02 RID: 2562
161 public Vector3 heldPos;
162
163 // Token: 0x04000A03 RID: 2563
164 public Vector3 heldPosFlip;
165
166 // Token: 0x04000A04 RID: 2564
167 public float flipFixX;
168
169 // Token: 0x04000A05 RID: 2565
170 public bool flipSR;
171
172 // Token: 0x04000A06 RID: 2566
173 public bool flipSelf;
174
175 // Token: 0x04000A07 RID: 2567
176 public bool onlyInstalled = true;
177
178 // Token: 0x04000A08 RID: 2568
179 public bool useOffsetBack = true;
180
181 // Token: 0x04000A09 RID: 2569
182 public bool alwaysFlip;
183
184 // Token: 0x04000A0A RID: 2570
185 public bool flipBack;
186
187 // Token: 0x04000A0B RID: 2571
188 public bool colorParticle;
189
190 // Token: 0x04000A0C RID: 2572
191 public SpriteRenderer sr;
192
193 // Token: 0x04000A0D RID: 2573
194 public Transform[] listTrans;
195
196 // Token: 0x04000A0E RID: 2574
197 public Vector3[] dirPos;
198
199 // Token: 0x04000A0F RID: 2575
200 private SourceMaterial.Row _mat;
201
202 // Token: 0x04000A10 RID: 2576
203 private Vector3 v;
204
205 // Token: 0x04000A11 RID: 2577
206 private Vector3 originalScale;
207
208 // Token: 0x04000A12 RID: 2578
209 private Vector3 originalAngle;
210
211 // Token: 0x02000884 RID: 2180
212 public enum Type
213 {
214 // Token: 0x04002470 RID: 9328
215 None,
216 // Token: 0x04002471 RID: 9329
217 Light,
218 // Token: 0x04002472 RID: 9330
219 Effect,
220 // Token: 0x04002473 RID: 9331
221 QuestBoard
222 }
223
224 // Token: 0x02000885 RID: 2181
225 public enum Hack
226 {
227 // Token: 0x04002475 RID: 9333
228 None,
229 // Token: 0x04002476 RID: 9334
230 Candle
231 }
232}
Definition Chara.cs:12
Definition EMono.cs:6
Definition Quest.cs:8
Definition TC.cs:6