Elin Modding Docs Doc
Loading...
Searching...
No Matches
TCOrbitChara.cs
1using System;
2using UnityEngine;
3
4// Token: 0x0200017D RID: 381
5public class TCOrbitChara : TCOrbit
6{
7 // Token: 0x06000B07 RID: 2823 RVA: 0x00044A68 File Offset: 0x00042C68
8 public override void OnSetOwner()
9 {
10 this.owner = (base.owner as Chara);
11 RenderData data = this.owner.renderer.data;
12 this.goIcon.transform.SetLocalPositionY(data.offset.y + data.size.y + 0.32f);
13 this.RefreshAll();
14 }
15
16 // Token: 0x06000B08 RID: 2824 RVA: 0x00044ACC File Offset: 0x00042CCC
17 public override void Refresh()
18 {
19 this.timer += Time.deltaTime;
20 if (this.timer > 0.2f)
21 {
22 this.timer = 0f;
23 this.RefreshAll();
24 }
25 if ((!this.owner.isHidden || EMono.pc.CanSee(this.owner)) && (this.showHP || this.showHP2 || this.showIcon))
26 {
27 if (!base.gameObject.activeSelf)
28 {
29 base.gameObject.SetActive(true);
30 }
31 base.transform.position = this.owner.renderer.position;
32 return;
33 }
34 if (base.gameObject.activeSelf)
35 {
36 base.gameObject.SetActive(false);
37 }
38 }
39
40 // Token: 0x06000B09 RID: 2825 RVA: 0x00044B94 File Offset: 0x00042D94
41 public void RefreshAll()
42 {
43 this.showHP = (this.showHP2 = (this.showIcon = false));
44 if (this.owner.isDead || this.owner.host != null)
45 {
46 return;
47 }
48 AIAct ai = this.owner.ai;
49 CoreRef.OrbitIcons orbitIcons = EMono.core.refs.orbitIcons;
50 Emo2 emo = this.owner.emoIcon;
51 if (emo == Emo2.none)
52 {
53 if (this.owner.isRestocking && !this.owner.IsPCParty && this.owner.trait.GetRestockedIcon() != Emo2.none && !(EMono._zone is Zone_Dungeon))
54 {
55 emo = this.owner.trait.GetRestockedIcon();
56 }
57 else if (EMono.player.currentHotItem.Thing != null && EMono.player.currentHotItem.Thing.trait.GetHeldEmo(this.owner) != Emo2.none)
58 {
59 emo = EMono.player.currentHotItem.Thing.trait.GetHeldEmo(this.owner);
60 }
61 else
62 {
63 bool flag = false;
64 if (this.owner.quest != null && EMono.game.quests.list.Contains(this.owner.quest))
65 {
66 flag = true;
67 }
68 else if (this.owner.IsUnique)
69 {
70 string id = this.owner.id;
71 if (!(id == "ashland"))
72 {
73 if (id == "fiama")
74 {
75 if (EMono.game.quests.GetPhase<QuestMain>() >= 200 && EMono.player.dialogFlags.TryGetValue("fiama1", 0) == 0)
76 {
77 flag = true;
78 }
79 else if (EMono.pc.homeBranch != null)
80 {
81 foreach (Chara chara in EMono.pc.homeBranch.members)
82 {
83 if (chara.isDead && chara.GetInt(100, null) != 0)
84 {
85 flag = true;
86 break;
87 }
88 }
89 }
90 }
91 }
92 else
93 {
94 int phase = EMono.game.quests.GetPhase<QuestMain>();
95 if ((phase == 0 && EMono.player.dialogFlags.TryGetValue("ash1", 0) == 0) || phase == 200)
96 {
97 flag = true;
98 }
99 }
100 }
101 if (flag)
102 {
103 emo = Emo2.hint;
104 }
105 }
106 }
107 this.showIcon = (emo > Emo2.none);
108 if (this.showIcon)
109 {
110 this.iconStatus.sprite = EMono.core.refs.spritesEmo[(int)emo];
111 }
112 this.iconStatus.SetActive(this.showIcon);
113 float num = (float)this.owner.hp / (float)this.owner.MaxHP;
114 this.showHP = (num < 0.9f && (this.owner.IsPCParty || this.owner.IsHostile() || (this.owner.enemy != null && this.owner.enemy.IsPCParty)));
115 if (this.showHP)
116 {
117 this.barHP.transform.SetLocalScaleX(num);
118 this.barHP.SetActive(true);
119 this.bgHP.SetActive(true);
120 }
121 else
122 {
123 this.barHP.SetActive(false);
124 this.bgHP.SetActive(false);
125 }
126 if (!this.barHP2)
127 {
128 return;
129 }
130 float num2 = Mathf.Min(new float[]
131 {
132 1f,
133 (this.owner.parasite != null) ? ((float)this.owner.parasite.hp / (float)this.owner.parasite.MaxHP) : 1f,
134 (this.owner.ride != null) ? ((float)this.owner.ride.hp / (float)this.owner.ride.MaxHP) : 1f
135 });
136 this.showHP2 = (num2 < 0.9f);
137 if (this.showHP2)
138 {
139 this.barHP2.transform.SetLocalScaleX(num2);
140 this.barHP2.SetActive(true);
141 this.bgHP2.SetActive(true);
142 return;
143 }
144 this.barHP2.SetActive(false);
145 this.bgHP2.SetActive(false);
146 }
147
148 // Token: 0x04000A1A RID: 2586
149 public GameObject goIcon;
150
151 // Token: 0x04000A1B RID: 2587
152 public SpriteRenderer iconRelation;
153
154 // Token: 0x04000A1C RID: 2588
155 public SpriteRenderer iconStatus;
156
157 // Token: 0x04000A1D RID: 2589
158 public SpriteRenderer barHP;
159
160 // Token: 0x04000A1E RID: 2590
161 public SpriteRenderer bgHP;
162
163 // Token: 0x04000A1F RID: 2591
164 public SpriteRenderer barHP2;
165
166 // Token: 0x04000A20 RID: 2592
167 public SpriteRenderer bgHP2;
168
169 // Token: 0x04000A21 RID: 2593
170 public new Chara owner;
171
172 // Token: 0x04000A22 RID: 2594
173 private float timer;
174
175 // Token: 0x04000A23 RID: 2595
176 private bool showHP;
177
178 // Token: 0x04000A24 RID: 2596
179 private bool showIcon;
180
181 // Token: 0x04000A25 RID: 2597
182 private bool showHP2;
183}
Definition AIAct.cs:7
Definition Chara.cs:12
Definition EMono.cs:6