Elin Decompiled Documentation EA 23.309 Nightly Patch 1
Loading...
Searching...
No Matches
Effect Class Reference
Inheritance diagram for Effect:
SceneObject EMono EffectIRenderer EffectMeteor EffectText

Public Types

enum  Type { Default , Firework }
 

Public Member Functions

void Play (float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
 
Effect Play (Point from, float fixY=0f, Point to=null, Sprite sprite=null)
 
Effect _Play (Point from, Vector3 fromV, float fixY=0f, Point to=null, Sprite sprite=null)
 
Effect Play (Vector3 v)
 
Effect Flip (bool x=false, bool y=false)
 
Effect SetStartDelay (float a)
 
virtual void OnPlay ()
 
virtual void OnUpdate ()
 
void Kill ()
 
virtual void OnKill ()
 
void OnDisable ()
 
void OnDestroy ()
 
Effect Emit (int num)
 
Effect SetParticleColor (Color c)
 
Effect SetParticleColor (Color color, bool changeMaterial=false, string idCol="_Color")
 
Effect SetScale (float a)
 

Static Public Member Functions

static Effect Get (Effect original)
 
static Effect Get (string id)
 
static T Get< T > (string id)
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 

Public Attributes

Type type
 
float duration = 1f
 
float speed
 
float startDelay
 
bool lookAtTarget
 
bool rotate
 
bool pool
 
SpriteRenderer sr
 
ParticleSystem[] systems
 
Vector3[] dirs
 
Ease ease
 
Vector3 posFix
 
Vector3 randomRange
 
Tween moveTween
 
Sprite[] sprites
 
bool randomFlip
 
bool randomSpeed
 
bool test
 
bool setColor = true
 
Action onComplete
 
int spriteIndex
 
float timer
 
Vector3 fromV
 
Vector3 destV
 
Vector3 orgLocalScale
 
List< MaterialmaterialsToDestroy
 
Point destPos
 
Tween killTimer
 

Protected Member Functions

void Activate ()
 

Properties

static EffectManager manager [get]
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void Awake ()
 

Additional Inherited Members

- Static Public Attributes inherited from EMono
static Core core
 

Detailed Description

Definition at line 6 of file Effect.cs.

Member Enumeration Documentation

◆ Type

Enumerator
Default 
Firework 

Definition at line 8 of file Effect.cs.

9 {
10 Default,
12 }

Member Function Documentation

◆ _Play()

Effect Effect._Play ( Point  from,
Vector3  fromV,
float  fixY = 0f,
Point  to = null,
Sprite  sprite = null 
)
inline

Definition at line 117 of file Effect.cs.

118 {
120 {
121 Kill();
122 return null;
123 }
124 if ((bool)sprite)
125 {
126 sr.sprite = sprite;
127 }
128 if (setColor && from.IsValid)
129 {
130 float num = 0.07f * (float)(int)from.cell.light + EMono.core.screen.tileMap._baseBrightness;
131 num += ((from.cell.HasRoof || from.cell.isShadowed) ? (-0.2f) : 0f);
132 if ((bool)sr)
133 {
134 sr.material.SetVector("_Color", new Vector4(num, num, num, 1f));
135 }
136 }
137 fromV += posFix;
138 fromV.y += fixY;
139 if (to == null)
140 {
141 fromV += randomRange.Random();
142 }
143 this.fromV = fromV;
144 destPos = to ?? from;
145 base.transform.position = fromV;
146 if (randomFlip)
147 {
148 sr.flipX = EMono.rnd(2) == 0;
149 }
150 if (to != null)
151 {
152 float num2 = Mathf.Min(speed * (float)from.Distance(to), duration);
153 destV = to.Position() + posFix + randomRange.Random();
154 if (rotate)
155 {
156 base.transform.rotation = from.GetRotation(to);
157 }
158 moveTween = base.transform.DOMove(destV, num2).SetEase(Ease.Linear).SetDelay(startDelay);
159 }
160 Activate();
161 OnPlay();
162 OnUpdate();
163 return this;
164 }
BaseTileMap tileMap
float _baseBrightness
Definition: BaseTileMap.cs:314
bool isShadowed
Definition: Cell.cs:254
BaseGameScreen screen
Definition: Core.cs:67
bool IsGameStarted
Definition: Core.cs:84
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static int rnd(int a)
Definition: EMono.cs:47
float speed
Definition: Effect.cs:18
virtual void OnUpdate()
Definition: Effect.cs:211
Point destPos
Definition: Effect.cs:73
virtual void OnPlay()
Definition: Effect.cs:207
SpriteRenderer sr
Definition: Effect.cs:28
bool rotate
Definition: Effect.cs:24
bool randomFlip
Definition: Effect.cs:44
float startDelay
Definition: Effect.cs:20
Vector3 randomRange
Definition: Effect.cs:38
float duration
Definition: Effect.cs:16
void Kill()
Definition: Effect.cs:240
Vector3 fromV
Definition: Effect.cs:61
bool setColor
Definition: Effect.cs:50
Vector3 posFix
Definition: Effect.cs:36
Tween moveTween
Definition: Effect.cs:40
Vector3 destV
Definition: Effect.cs:64
void Activate()
Definition: Effect.cs:181
ref Vector3 Position(int height)
Definition: Point.cs:548
bool IsValid
Definition: Point.cs:88
Cell cell
Definition: Point.cs:51

References BaseTileMap._baseBrightness, Activate(), Point.cell, EMono.core, destPos, destV, Point.Distance(), duration, fromV, Point.GetRotation(), Core.IsGameStarted, Cell.isShadowed, Point.IsValid, Kill(), moveTween, OnPlay(), OnUpdate(), posFix, randomFlip, randomRange, EMono.rnd(), rotate, Core.screen, setColor, speed, sr, startDelay, and BaseGameScreen.tileMap.

Referenced by Chara.Kiss(), EffectIRenderer.Play(), Play(), Card.PlayEffect(), and AttackProcess.PlayRangedAnime().

◆ Activate()

void Effect.Activate ( )
inlineprotected

Definition at line 181 of file Effect.cs.

182 {
183 if (sprites.Length != 0 && type != Type.Firework)
184 {
185 sr.enabled = false;
186 }
187 manager.Add(this);
188 killTimer = TweenUtil.Tween(startDelay + duration + 0.01f + (float)sprites.Length * 0.01f, null, Kill);
189 }
void Add(Effect e)
static EffectManager manager
Definition: Effect.cs:78
Tween killTimer
Definition: Effect.cs:76
Sprite[] sprites
Definition: Effect.cs:42
Type type
Definition: Effect.cs:14
Type
Definition: Effect.cs:9

References EffectManager.Add(), duration, Kill(), killTimer, manager, sprites, startDelay, and type.

Referenced by _Play(), EffectIRenderer.Play(), and Play().

◆ Awake()

void Effect.Awake ( )
inlineprivate

Definition at line 95 of file Effect.cs.

96 {
97 orgLocalScale = base.transform.localScale;
98 }
Vector3 orgLocalScale
Definition: Effect.cs:67

References orgLocalScale.

◆ Emit()

Effect Effect.Emit ( int  num)
inline

Definition at line 283 of file Effect.cs.

284 {
285 ParticleSystem[] array = systems;
286 for (int i = 0; i < array.Length; i++)
287 {
288 array[i].Emit(num);
289 }
290 return this;
291 }
ParticleSystem[] systems
Definition: Effect.cs:30

References systems.

Referenced by Card.DamageHP(), Card.Die(), TraitSyringe.EffectInject(), and AttackProcess.PlayRangedAnime().

◆ Flip()

Effect Effect.Flip ( bool  x = false,
bool  y = false 
)
inline

Definition at line 191 of file Effect.cs.

192 {
193 if ((bool)sr)
194 {
195 sr.flipX = (sr.flipX ? (!x) : x);
196 sr.flipY = (sr.flipY ? (!y) : y);
197 }
198 return this;
199 }

References sr.

◆ Get() [1/2]

◆ Get() [2/2]

static Effect Effect.Get ( string  id)
inlinestatic

Definition at line 85 of file Effect.cs.

86 {
87 return manager.effects.Get(id);
88 }
Effect Get(string id)
Definition: EffectManager.cs:9
EffectList effects

References EffectManager.effects, EffectManager.EffectList.Get(), and manager.

◆ Get< T >()

static T Effect.Get< T > ( string  id)
inlinestatic
Type Constraints
T :Effect 

Definition at line 90 of file Effect.cs.

90 : Effect
91 {
92 return manager.effects.Get(id) as T;
93 }
Definition: Effect.cs:7

References EffectManager.effects, EffectManager.EffectList.Get(), and manager.

◆ Kill()

void Effect.Kill ( )
inline

Definition at line 240 of file Effect.cs.

241 {
242 TweenUtil.KillTween(ref killTimer);
243 TweenUtil.KillTween(ref moveTween);
244 timer = 0f;
245 spriteIndex = 0;
246 base.transform.localScale = orgLocalScale;
247 OnKill();
248 manager.Remove(this);
250 {
251 PoolManager.DespawnOrDestroy(base.transform);
252 }
253 else if ((bool)base.gameObject)
254 {
255 UnityEngine.Object.Destroy(base.gameObject);
256 }
257 }
void Remove(Effect e)
int spriteIndex
Definition: Effect.cs:55
float timer
Definition: Effect.cs:58
bool pool
Definition: Effect.cs:26
virtual void OnKill()
Definition: Effect.cs:259
static void DespawnOrDestroy(Component c)
Definition: PoolManager.cs:158

References PoolManager.DespawnOrDestroy(), EffectManager.effects, killTimer, manager, moveTween, OnKill(), orgLocalScale, pool, EffectManager.Remove(), spriteIndex, timer, and DynamicAsset< T >.usePool.

Referenced by _Play(), Activate(), OnDisable(), OnUpdate(), EffectIRenderer.Play(), and Play().

◆ OnDestroy()

void Effect.OnDestroy ( )
inline

Definition at line 271 of file Effect.cs.

272 {
273 if (materialsToDestroy == null)
274 {
275 return;
276 }
277 foreach (Material item in materialsToDestroy)
278 {
279 UnityEngine.Object.Destroy(item);
280 }
281 }
List< Material > materialsToDestroy
Definition: Effect.cs:70

References item, Material, and materialsToDestroy.

◆ OnDisable()

void Effect.OnDisable ( )
inline

Definition at line 263 of file Effect.cs.

264 {
265 if ((bool)base.transform.parent && !test && (!pool || !manager.effects.usePool))
266 {
267 Kill();
268 }
269 }
bool test
Definition: Effect.cs:48

References EffectManager.effects, Kill(), manager, pool, test, and DynamicAsset< T >.usePool.

◆ OnKill()

virtual void Effect.OnKill ( )
inlinevirtual

Reimplemented in EffectIRenderer.

Definition at line 259 of file Effect.cs.

260 {
261 }

Referenced by Kill().

◆ OnPlay()

virtual void Effect.OnPlay ( )
inlinevirtual

Reimplemented in EffectMeteor.

Definition at line 207 of file Effect.cs.

208 {
209 }

Referenced by _Play(), and Play().

◆ OnUpdate()

virtual void Effect.OnUpdate ( )
inlinevirtual

Reimplemented in EffectIRenderer.

Definition at line 211 of file Effect.cs.

212 {
213 if (!base.gameObject.activeSelf)
214 {
215 base.gameObject.SetActive(value: true);
216 }
217 timer += (randomSpeed ? UnityEngine.Random.Range(Time.deltaTime, Time.deltaTime * 1.5f) : Time.deltaTime);
218 if (startDelay != 0f)
219 {
220 if (timer < startDelay)
221 {
222 return;
223 }
224 timer = (startDelay = 0f);
225 }
226 if (sprites.Length != 0 && type != Type.Firework && timer > duration / (float)sprites.Length)
227 {
228 timer = 0f;
229 spriteIndex++;
230 if (spriteIndex >= sprites.Length)
231 {
232 Kill();
233 return;
234 }
235 sr.enabled = true;
236 sr.sprite = sprites[spriteIndex];
237 }
238 }
bool randomSpeed
Definition: Effect.cs:46

References duration, Kill(), randomSpeed, spriteIndex, sprites, startDelay, timer, and type.

Referenced by _Play(), and Play().

◆ Play() [1/3]

void Effect.Play ( float  delay,
Point  from,
float  fixY = 0f,
Point  to = null,
Sprite  sprite = null 
)
inline

◆ Play() [2/3]

Effect Effect.Play ( Point  from,
float  fixY = 0f,
Point  to = null,
Sprite  sprite = null 
)
inline

Definition at line 112 of file Effect.cs.

113 {
114 return _Play(from, from.Position(), fixY, to, sprite);
115 }
Effect _Play(Point from, Vector3 fromV, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:117

References _Play(), and Point.Position().

◆ Play() [3/3]

Effect Effect.Play ( Vector3  v)
inline

Definition at line 166 of file Effect.cs.

167 {
169 {
170 Kill();
171 return null;
172 }
173 fromV = v;
174 base.transform.position = fromV + posFix;
175 Activate();
176 OnPlay();
177 OnUpdate();
178 return this;
179 }

References Activate(), EMono.core, fromV, Core.IsGameStarted, Kill(), OnPlay(), OnUpdate(), and posFix.

◆ SetParticleColor() [1/2]

Effect Effect.SetParticleColor ( Color  c)
inline

Definition at line 293 of file Effect.cs.

294 {
295 ParticleSystem[] array = systems;
296 for (int i = 0; i < array.Length; i++)
297 {
298 ParticleSystem.MainModule main = array[i].main;
299 main.startColor = c;
300 }
301 return this;
302 }

References systems.

Referenced by ActEffect.DamageEle(), Card.DamageHP(), Card.Die(), TraitSyringe.EffectInject(), and TraitEffect.Proc().

◆ SetParticleColor() [2/2]

Effect Effect.SetParticleColor ( Color  color,
bool  changeMaterial = false,
string  idCol = "_Color" 
)
inline

Definition at line 304 of file Effect.cs.

305 {
306 if (changeMaterial)
307 {
308 materialsToDestroy = new List<Material>();
309 }
310 ParticleSystem[] array = systems;
311 foreach (ParticleSystem particleSystem in array)
312 {
313 if (changeMaterial)
314 {
315 Material material = particleSystem.GetComponent<ParticleSystemRenderer>().material;
316 if (!manager.effects.usePool || !pool)
317 {
319 }
320 material.SetColor(idCol, color);
321 }
322 else
323 {
324 ParticleSystem.MainModule main = particleSystem.main;
325 main.startColor = color;
326 }
327 }
328 return this;
329 }

References EffectManager.effects, manager, material, Material, materialsToDestroy, pool, systems, and DynamicAsset< T >.usePool.

◆ SetScale()

Effect Effect.SetScale ( float  a)
inline

Definition at line 331 of file Effect.cs.

332 {
333 base.transform.localScale *= a;
334 return this;
335 }

Referenced by ActMoneySlap.Perform().

◆ SetStartDelay()

Effect Effect.SetStartDelay ( float  a)
inline

Definition at line 201 of file Effect.cs.

202 {
203 startDelay = a;
204 return this;
205 }

References startDelay.

Referenced by ActEffect.DamageEle().

Member Data Documentation

◆ destPos

Point Effect.destPos

Definition at line 73 of file Effect.cs.

Referenced by _Play(), and EffectMeteor.OnPlay().

◆ destV

Vector3 Effect.destV

◆ dirs

Vector3 [] Effect.dirs

Definition at line 32 of file Effect.cs.

Referenced by TraitEffect.Proc().

◆ duration

float Effect.duration = 1f

Definition at line 16 of file Effect.cs.

Referenced by _Play(), Activate(), OnUpdate(), and EffectIRenderer.OnUpdate().

◆ ease

Ease Effect.ease

Definition at line 34 of file Effect.cs.

◆ fromV

Vector3 Effect.fromV

Definition at line 61 of file Effect.cs.

Referenced by _Play(), EffectMeteor.OnPlay(), and Play().

◆ killTimer

Tween Effect.killTimer

Definition at line 76 of file Effect.cs.

Referenced by Activate(), and Kill().

◆ lookAtTarget

bool Effect.lookAtTarget

Definition at line 22 of file Effect.cs.

◆ materialsToDestroy

List<Material> Effect.materialsToDestroy

Definition at line 70 of file Effect.cs.

Referenced by OnDestroy(), and SetParticleColor().

◆ moveTween

Tween Effect.moveTween

Definition at line 40 of file Effect.cs.

Referenced by _Play(), Kill(), and EffectMeteor.OnPlay().

◆ onComplete

Action Effect.onComplete

Definition at line 52 of file Effect.cs.

Referenced by EffectMeteor.Create(), and EffectMeteor.OnPlay().

◆ orgLocalScale

Vector3 Effect.orgLocalScale

Definition at line 67 of file Effect.cs.

Referenced by Awake(), and Kill().

◆ pool

bool Effect.pool

Definition at line 26 of file Effect.cs.

Referenced by Kill(), OnDisable(), and SetParticleColor().

◆ posFix

Vector3 Effect.posFix

Definition at line 36 of file Effect.cs.

Referenced by _Play(), EffectText.Play(), and Play().

◆ randomFlip

bool Effect.randomFlip

Definition at line 44 of file Effect.cs.

Referenced by _Play().

◆ randomRange

Vector3 Effect.randomRange

Definition at line 38 of file Effect.cs.

Referenced by _Play(), and EffectText.Play().

◆ randomSpeed

bool Effect.randomSpeed

Definition at line 46 of file Effect.cs.

Referenced by OnUpdate().

◆ rotate

bool Effect.rotate

Definition at line 24 of file Effect.cs.

Referenced by _Play().

◆ setColor

bool Effect.setColor = true

Definition at line 50 of file Effect.cs.

Referenced by _Play().

◆ speed

float Effect.speed

Definition at line 18 of file Effect.cs.

Referenced by _Play(), and EffectIRenderer.OnUpdate().

◆ spriteIndex

int Effect.spriteIndex

Definition at line 55 of file Effect.cs.

Referenced by Kill(), and OnUpdate().

◆ sprites

Sprite [] Effect.sprites

Definition at line 42 of file Effect.cs.

Referenced by Activate(), OnUpdate(), TraitEffect.Proc(), and TraitEffect.TrySetAct().

◆ sr

SpriteRenderer Effect.sr

Definition at line 28 of file Effect.cs.

Referenced by _Play(), and Flip().

◆ startDelay

float Effect.startDelay

Definition at line 20 of file Effect.cs.

Referenced by _Play(), Activate(), EffectMeteor.OnPlay(), OnUpdate(), and SetStartDelay().

◆ systems

ParticleSystem [] Effect.systems

Definition at line 30 of file Effect.cs.

Referenced by Emit(), SetParticleColor(), and TraitEffect.TrySetAct().

◆ test

bool Effect.test

Definition at line 48 of file Effect.cs.

Referenced by OnDisable().

◆ timer

float Effect.timer

Definition at line 58 of file Effect.cs.

Referenced by Kill(), OnUpdate(), and EffectIRenderer.OnUpdate().

◆ type

Type Effect.type

Definition at line 14 of file Effect.cs.

Referenced by Activate(), and OnUpdate().

Property Documentation

◆ manager

EffectManager Effect.manager
staticget

Definition at line 78 of file Effect.cs.

Referenced by Activate(), Get(), Get< T >(), Kill(), OnDisable(), and SetParticleColor().


The documentation for this class was generated from the following file: