Elin Decompiled Documentation EA 23.273 Nyaightly 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
 
bool pooled
 
Transform poolParent
 
List< MaterialmaterialsToDestroy
 
Point destPos
 
Tween killTimer
 

Protected Member Functions

void Activate ()
 

Protected Attributes

bool killed
 

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]
 

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:246
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:76
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 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:83
Tween killTimer
Definition: Effect.cs:81
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().

◆ Emit()

Effect Effect.Emit ( int  num)
inline

Definition at line 281 of file Effect.cs.

282 {
283 ParticleSystem[] array = systems;
284 for (int i = 0; i < array.Length; i++)
285 {
286 array[i].Emit(num);
287 }
288 return this;
289 }
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 90 of file Effect.cs.

91 {
92 return manager.effects.Get(id);
93 }
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 95 of file Effect.cs.

95 : Effect
96 {
97 return manager.effects.Get(id) as T;
98 }
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 killed = true;
245 OnKill();
246 manager.Remove(this);
248 {
249 PoolManager.DespawnOrDestroy(base.transform);
250 }
251 else if ((bool)base.gameObject)
252 {
253 UnityEngine.Object.Destroy(base.gameObject);
254 }
255 }
void Remove(Effect e)
bool killed
Definition: Effect.cs:78
bool pool
Definition: Effect.cs:26
virtual void OnKill()
Definition: Effect.cs:257
static void DespawnOrDestroy(Component c)
Definition: PoolManager.cs:158

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

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

◆ OnDestroy()

void Effect.OnDestroy ( )
inline

Definition at line 269 of file Effect.cs.

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

References item, Material, and materialsToDestroy.

◆ OnDisable()

void Effect.OnDisable ( )
inline

Definition at line 261 of file Effect.cs.

262 {
263 if ((bool)base.transform.parent && !test)
264 {
265 Kill();
266 }
267 }
bool test
Definition: Effect.cs:48

References Kill(), and test.

◆ OnKill()

virtual void Effect.OnKill ( )
inlinevirtual

Reimplemented in EffectIRenderer.

Definition at line 257 of file Effect.cs.

258 {
259 }

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 }
int spriteIndex
Definition: Effect.cs:55
float timer
Definition: Effect.cs:58
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 291 of file Effect.cs.

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

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 302 of file Effect.cs.

303 {
304 if (changeMaterial)
305 {
306 materialsToDestroy = new List<Material>();
307 }
308 ParticleSystem[] array = systems;
309 foreach (ParticleSystem particleSystem in array)
310 {
311 if (changeMaterial)
312 {
313 Material material = particleSystem.GetComponent<ParticleSystemRenderer>().material;
315 material.SetColor(idCol, color);
316 }
317 else
318 {
319 ParticleSystem.MainModule main = particleSystem.main;
320 main.startColor = color;
321 }
322 }
323 return this;
324 }

References material, Material, materialsToDestroy, and systems.

◆ SetScale()

Effect Effect.SetScale ( float  a)
inline

Definition at line 326 of file Effect.cs.

327 {
328 base.transform.localScale *= a;
329 return this;
330 }

◆ 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 76 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().

◆ killed

bool Effect.killed
protected

Definition at line 78 of file Effect.cs.

Referenced by Kill().

◆ killTimer

Tween Effect.killTimer

Definition at line 81 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 73 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().

◆ pool

bool Effect.pool

Definition at line 26 of file Effect.cs.

Referenced by Kill().

◆ pooled

bool Effect.pooled

Definition at line 67 of file Effect.cs.

◆ poolParent

Transform Effect.poolParent

Definition at line 70 of file Effect.cs.

◆ 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 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 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 83 of file Effect.cs.

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


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