Elin Decompiled Documentation EA 23.189 Nightly
Loading...
Searching...
No Matches
TCOrbitChara.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class TCOrbitChara : TCOrbit
4{
5 public GameObject goIcon;
6
7 public SpriteRenderer iconRelation;
8
9 public SpriteRenderer iconStatus;
10
11 public SpriteRenderer barHP;
12
13 public SpriteRenderer bgHP;
14
15 public SpriteRenderer barHP2;
16
17 public SpriteRenderer bgHP2;
18
19 public new Chara owner;
20
21 private float timer;
22
23 private bool showHP;
24
25 private bool showIcon;
26
27 private bool showHP2;
28
29 public override void OnSetOwner()
30 {
31 owner = base.owner as Chara;
33 goIcon.transform.SetLocalPositionY(data.offset.y + data.size.y + 0.32f);
34 RefreshAll();
35 }
36
37 public override void Refresh()
38 {
39 timer += Time.deltaTime;
40 if (timer > 0.2f)
41 {
42 timer = 0f;
43 RefreshAll();
44 }
45 if ((!owner.isHidden || EMono.pc.CanSee(owner)) && (showHP || showHP2 || showIcon))
46 {
47 if (!base.gameObject.activeSelf)
48 {
49 base.gameObject.SetActive(value: true);
50 }
51 base.transform.position = owner.renderer.position;
52 }
53 else if (base.gameObject.activeSelf)
54 {
55 base.gameObject.SetActive(value: false);
56 }
57 }
58
59 public void RefreshAll()
60 {
61 showHP = (showHP2 = (showIcon = false));
62 if (owner.isDead || owner.host != null)
63 {
64 return;
65 }
66 _ = owner.ai;
68 Emo2 emo = owner.emoIcon;
69 if (emo == Emo2.none)
70 {
72 {
73 emo = Emo2.hintEvent;
74 }
75 else if (owner.isRestocking && (!owner.IsPCParty || EMono._zone.IsPCFaction) && owner.trait.GetRestockedIcon() != 0 && !(EMono._zone is Zone_Dungeon))
76 {
78 }
79 else
80 {
81 bool flag = false;
82 if (owner.quest != null && EMono.game.quests.list.Contains(owner.quest))
83 {
84 flag = true;
85 }
86 else if (owner.IsUnique && !EMono.game.IsSurvival)
87 {
88 string id = owner.id;
89 if (!(id == "ashland"))
90 {
91 if (id == "fiama")
92 {
93 if (EMono.game.quests.GetPhase<QuestMain>() >= 200 && EMono.player.dialogFlags.TryGetValue("fiama1", 0) == 0)
94 {
95 flag = true;
96 }
97 else if (EMono.pc.homeBranch != null)
98 {
99 foreach (Chara member in EMono.pc.homeBranch.members)
100 {
101 if (member.isDead && member.GetInt(100) != 0)
102 {
103 flag = true;
104 break;
105 }
106 }
107 }
108 }
109 }
110 else
111 {
112 int phase = EMono.game.quests.GetPhase<QuestMain>();
113 if ((phase == 0 && EMono.player.dialogFlags.TryGetValue("ash1", 0) == 0) || phase == 200)
114 {
115 flag = true;
116 }
117 }
118 }
119 if (flag)
120 {
121 emo = Emo2.hint;
122 }
123 }
124 }
126 {
128 }
129 showIcon = emo != Emo2.none;
130 if (showIcon)
131 {
132 iconStatus.sprite = EMono.core.refs.spritesEmo[(int)emo];
133 }
134 iconStatus.SetActive(showIcon);
135 float num = (float)owner.hp / (float)owner.MaxHP;
136 showHP = num < 0.9f && (owner.IsPCParty || owner.IsHostile() || (owner.enemy != null && owner.enemy.IsPCParty));
137 if (showHP)
138 {
139 barHP.transform.SetLocalScaleX(Mathf.Max(0f, num));
140 barHP.SetActive(enable: true);
141 bgHP.SetActive(enable: true);
142 }
143 else
144 {
145 barHP.SetActive(enable: false);
146 bgHP.SetActive(enable: false);
147 }
148 if ((bool)barHP2)
149 {
150 float num2 = Mathf.Min(1f, (owner.parasite != null) ? ((float)owner.parasite.hp / (float)owner.parasite.MaxHP) : 1f, (owner.ride != null) ? ((float)owner.ride.hp / (float)owner.ride.MaxHP) : 1f);
151 showHP2 = num2 < 0.9f;
152 if (showHP2)
153 {
154 barHP2.transform.SetLocalScaleX(Mathf.Max(0f, num2));
155 barHP2.SetActive(enable: true);
156 bgHP2.SetActive(enable: true);
157 }
158 else
159 {
160 barHP2.SetActive(enable: false);
161 bgHP2.SetActive(enable: false);
162 }
163 }
164 }
165}
Emo2
Definition: Emo2.cs:2
bool CanGiveCard()
Definition: Affinity.cs:63
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
Vector3 position
Definition: CardRenderer.cs:21
string id
Definition: Card.cs:33
bool IsUnique
Definition: Card.cs:2053
bool isRestocking
Definition: Card.cs:876
int hp
Definition: Card.cs:228
Trait trait
Definition: Card.cs:51
bool isHidden
Definition: Card.cs:516
CardRenderer renderer
Definition: Card.cs:59
Definition: Chara.cs:10
new TraitChara trait
Definition: Chara.cs:501
AIAct ai
Definition: Chara.cs:200
override bool IsPC
Definition: Chara.cs:610
Chara host
Definition: Chara.cs:33
override bool IsPCParty
Definition: Chara.cs:613
Emo2 emoIcon
Definition: Chara.cs:106
bool CanSee(Card c)
Definition: Chara.cs:1200
override int MaxHP
Definition: Chara.cs:706
Chara parasite
Definition: Chara.cs:30
Chara ride
Definition: Chara.cs:27
Affinity affinity
Definition: Chara.cs:312
Chara enemy
Definition: Chara.cs:86
Quest quest
Definition: Chara.cs:24
FactionBranch homeBranch
Definition: Chara.cs:1052
bool IsHostile()
Definition: Chara.cs:6229
bool isDead
Definition: Chara.cs:387
bool DroppedCard(string id)
Definition: CodexManager.cs:46
List< Sprite > spritesEmo
Definition: CoreRef.cs:375
OrbitIcons orbitIcons
Definition: CoreRef.cs:345
CoreRef refs
Definition: Core.cs:51
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static Chara pc
Definition: EMono.cs:13
static Player player
Definition: EMono.cs:11
static Zone _zone
Definition: EMono.cs:19
static Game game
Definition: EMono.cs:7
List< Chara > members
bool IsSurvival
Definition: Game.cs:272
QuestManager quests
Definition: Game.cs:179
virtual Thing Thing
Definition: HotItem.cs:38
CodexManager codex
Definition: Player.cs:1035
Dictionary< string, int > dialogFlags
Definition: Player.cs:960
HotItem currentHotItem
Definition: Player.cs:1020
List< Quest > list
Definition: QuestManager.cs:11
Vector3 offset
Definition: RenderData.cs:18
Vector2 size
Definition: RenderData.cs:30
RenderData data
Definition: RenderObject.cs:34
SpriteRenderer iconStatus
Definition: TCOrbitChara.cs:9
override void Refresh()
Definition: TCOrbitChara.cs:37
new Chara owner
Definition: TCOrbitChara.cs:19
void RefreshAll()
Definition: TCOrbitChara.cs:59
SpriteRenderer barHP
Definition: TCOrbitChara.cs:11
SpriteRenderer barHP2
Definition: TCOrbitChara.cs:15
override void OnSetOwner()
Definition: TCOrbitChara.cs:29
SpriteRenderer bgHP2
Definition: TCOrbitChara.cs:17
SpriteRenderer bgHP
Definition: TCOrbitChara.cs:13
GameObject goIcon
Definition: TCOrbitChara.cs:5
SpriteRenderer iconRelation
Definition: TCOrbitChara.cs:7
Emo2 GetRestockedIcon()
Definition: Trait.cs:1474
virtual Emo2 GetHeldEmo(Chara c)
Definition: Trait.cs:627
bool IsPCFaction
Definition: Zone.cs:468