Elin Modding Docs Doc
Loading...
Searching...
No Matches
CharaActorPCC.cs
1using System;
2using UnityEngine;
3
4// Token: 0x02000176 RID: 374
6{
7 // Token: 0x170002B6 RID: 694
8 // (get) Token: 0x06000ADE RID: 2782 RVA: 0x00043675 File Offset: 0x00041875
9 public override bool isPCC
10 {
11 get
12 {
13 return true;
14 }
15 }
16
17 // Token: 0x170002B7 RID: 695
18 // (get) Token: 0x06000ADF RID: 2783 RVA: 0x00043678 File Offset: 0x00041878
19 public override int currentDir
20 {
21 get
22 {
23 return this.provider.currentDir;
24 }
25 }
26
27 // Token: 0x06000AE0 RID: 2784 RVA: 0x00043688 File Offset: 0x00041888
28 public override void OnSetOwner()
29 {
30 base.SetOwnerAsChara();
31 this.sr.flipX = false;
32 this.pcc = PCC.Get((this.owner.renderer as CharaRenderer).pccData);
33 this.provider.onSetSprite = delegate(Sprite a)
34 {
35 this.sr.sprite = a;
36 this.mpb.SetTexture("_MainTex", this.sr.sprite.texture);
37 };
38 this.provider.angle = this.owner.angle;
39 this.provider.SetPCC(this.pcc);
40 this.mpb.SetTexture("_MainTex", this.sr.sprite.texture);
41 this.IdleFrame();
42 }
43
44 // Token: 0x06000AE1 RID: 2785 RVA: 0x0004372B File Offset: 0x0004192B
45 public override void NextFrame()
46 {
47 if (this.lastNextFrame == Time.timeSinceLevelLoad)
48 {
49 return;
50 }
51 this.provider.NextFrame();
52 this.lastNextFrame = Time.timeSinceLevelLoad;
53 }
54
55 // Token: 0x06000AE2 RID: 2786 RVA: 0x00043752 File Offset: 0x00041952
56 public override void IdleFrame()
57 {
58 if (!this.owner.isDead)
59 {
60 this.provider.SetSpriteIdle();
61 }
62 }
63
64 // Token: 0x06000AE3 RID: 2787 RVA: 0x0004376C File Offset: 0x0004196C
65 public override int GetFrame()
66 {
67 return this.provider.currentFrame % 2;
68 }
69
70 // Token: 0x06000AE4 RID: 2788 RVA: 0x0004377C File Offset: 0x0004197C
71 public override void NextDir()
72 {
73 this.provider.NextDir(15f);
74 this.owner.angle = this.provider.angle;
75 this.provider.SetDir();
76 this.provider.SetSpriteMain();
77 this.RefreshSprite();
78 }
79
80 // Token: 0x06000AE5 RID: 2789 RVA: 0x000437CB File Offset: 0x000419CB
81 public override void Kill()
82 {
83 base.Kill();
84 this.pcc = null;
85 this.provider.pcc = null;
86 }
87
88 // Token: 0x06000AE6 RID: 2790 RVA: 0x000437E8 File Offset: 0x000419E8
89 public override void OnRender(RenderParam p)
90 {
91 base.OnRender(p);
92 if (this.pcc.data.isUnique)
93 {
94 return;
95 }
96 CharaActorPCC.org.x = p.x;
97 CharaActorPCC.org.y = p.y;
98 CharaActorPCC.org.z = p.z + this.owner.renderer.data.offset.z;
99 bool flag = this.owner.combatCount <= 0 && EMono.core.config.game.hideWeapons;
100 Cell cell = this.owner.Cell;
101 if ((this.owner.held == null || (this.owner.held.trait.ShowAsTool && !HotItemHeld.disableTool)) && !this.owner.IsDeadOrSleeping && this.pcc.data.state != PCCState.Naked && (this.owner.Cell.isFloating || !cell.sourceSurface.tileType.IsDeepWater || cell.IsIceTile))
102 {
103 int currentDir = this.currentDir;
104 int tempLeft = this.pcc.data.tempLeft;
105 int tempRight = this.pcc.data.tempRight;
106 if (tempRight != 0)
107 {
108 if (tempRight != -1)
109 {
110 RenderData renderTempEQ = EMono.scene.screenElin.renderTempEQ;
111 bool flag2 = currentDir == 0 || currentDir == 1;
112 Vector3[] mainHandPos = EMono.setting.render.mainHandPos;
113 Vector3[] mainHand = EMono.setting.render.animeWalk[this.provider.currentFrame].mainHand;
114 p.tile = (float)(tempRight * (flag2 ? 1 : -1));
115 p.matColor = 104025f;
116 p.x = CharaActorPCC.org.x + mainHandPos[currentDir].x + mainHand[currentDir].x;
117 p.y = CharaActorPCC.org.y + mainHandPos[currentDir].y + mainHand[currentDir].y;
118 p.z = CharaActorPCC.org.z - renderTempEQ.offset.z + mainHandPos[currentDir].z + mainHand[currentDir].z;
119 renderTempEQ.Draw(p);
120 }
121 }
122 else
123 {
124 Thing thing;
125 if (!this.owner.IsPC || EMono.player.currentHotItem.RenderThing == null)
126 {
127 if (!flag)
128 {
129 BodySlot slotMainHand = this.owner.body.slotMainHand;
130 if (((slotMainHand != null) ? slotMainHand.thing : null) != null)
131 {
132 thing = this.owner.body.slotMainHand.thing;
133 goto IL_2C9;
134 }
135 }
136 thing = null;
137 }
138 else
139 {
140 thing = EMono.player.currentHotItem.RenderThing;
141 }
142 IL_2C9:
143 Thing thing2 = thing;
144 if (thing2 != null)
145 {
146 bool flag3 = currentDir == 0 || currentDir == 1;
147 if (thing2.trait.InvertHeldSprite)
148 {
149 flag3 = !flag3;
150 }
151 Vector3[] mainHandPos2 = EMono.setting.render.mainHandPos;
152 Vector3[] mainHand2 = EMono.setting.render.animeWalk[this.provider.currentFrame].mainHand;
153 SourcePref pref = thing2.sourceCard.pref;
154 thing2.dir = (flag3 ? 0 : 1);
155 thing2.SetRenderParam(p);
156 p.x = CharaActorPCC.org.x + mainHandPos2[currentDir].x + mainHand2[currentDir].x + (flag3 ? 0.01f : -0.01f) * (float)pref.equipX;
157 p.y = CharaActorPCC.org.y + mainHandPos2[currentDir].y + mainHand2[currentDir].y + 0.01f * (float)pref.equipY;
158 p.z = CharaActorPCC.org.z - thing2.renderer.data.offset.z + mainHandPos2[currentDir].z + mainHand2[currentDir].z;
159 p.v.x = p.x;
160 p.v.y = p.y;
161 p.v.z = p.z;
162 thing2.renderer.Draw(p, ref p.v, false);
163 }
164 }
165 if (tempLeft != 0)
166 {
167 if (tempLeft != -1)
168 {
169 RenderData renderTempEQ2 = EMono.scene.screenElin.renderTempEQ;
170 bool flag4 = currentDir == 1 || currentDir == 3;
171 Vector3[] offHandPos = EMono.setting.render.offHandPos;
172 Vector3[] offHand = EMono.setting.render.animeWalk[this.provider.currentFrame].offHand;
173 p.tile = (float)(tempLeft * (flag4 ? 1 : -1));
174 p.matColor = 104025f;
175 p.x = CharaActorPCC.org.x + offHandPos[currentDir].x + offHand[currentDir].x;
176 p.y = CharaActorPCC.org.y + offHandPos[currentDir].y + offHand[currentDir].y;
177 p.z = CharaActorPCC.org.z - renderTempEQ2.offset.z + offHandPos[currentDir].z + offHand[currentDir].z;
178 renderTempEQ2.Draw(p);
179 }
180 }
181 else if (!flag && this.owner.body.slotOffHand != null && EMono.core.config.game.showOffhand)
182 {
183 Thing thing3 = this.owner.body.slotOffHand.thing;
184 if (thing3 != null)
185 {
186 bool flag5 = currentDir == 1 || currentDir == 3;
187 Vector3[] offHandPos2 = EMono.setting.render.offHandPos;
188 Vector3[] offHand2 = EMono.setting.render.animeWalk[this.provider.currentFrame].offHand;
189 SourcePref pref2 = thing3.source.pref;
190 thing3.dir = (flag5 ? 0 : 1);
191 thing3.SetRenderParam(p);
192 p.x = CharaActorPCC.org.x + offHandPos2[currentDir].x + offHand2[currentDir].x + (flag5 ? 0.01f : -0.01f) * (float)pref2.equipX;
193 p.y = CharaActorPCC.org.y + offHandPos2[currentDir].y + offHand2[currentDir].y + 0.01f * (float)pref2.equipY;
194 p.z = CharaActorPCC.org.z - thing3.renderer.data.offset.z + offHandPos2[currentDir].z + offHand2[currentDir].z;
195 thing3.renderer.Draw(p);
196 }
197 }
198 }
199 p.x = CharaActorPCC.org.x;
200 p.y = CharaActorPCC.org.y;
201 p.z = CharaActorPCC.org.z - this.owner.renderer.data.offset.z;
202 }
203
204 // Token: 0x06000AE7 RID: 2791 RVA: 0x00043F36 File Offset: 0x00042136
205 public override void RefreshSprite()
206 {
207 this.provider.angle = this.owner.angle;
208 this.provider.SetDir();
209 this.provider.SetSpriteMain();
210 base.RefreshSprite();
211 }
212
213 // Token: 0x040009F6 RID: 2550
214 private static Vector3 org;
215
216 // Token: 0x040009F7 RID: 2551
217 public PCC pcc;
218
219 // Token: 0x040009F8 RID: 2552
220 public SpriteProvider provider = new SpriteProvider();
221
222 // Token: 0x040009F9 RID: 2553
223 private float lastNextFrame;
224
225 // Token: 0x040009FA RID: 2554
226 public static Vector3 V2 = new Vector3(2f, 2f, 1f);
227}
Definition Cell.cs:10
Definition EMono.cs:6
Definition Thing.cs:10