Elin Decompiled Documentation EA 23.102 Nightly
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 115 of file Effect.cs.

116 {
118 {
119 Kill();
120 return null;
121 }
122 if ((bool)sprite)
123 {
124 sr.sprite = sprite;
125 }
126 if (setColor)
127 {
128 float num = 0.07f * (float)(int)from.cell.light + EMono.core.screen.tileMap._baseBrightness;
129 num += ((from.cell.HasRoof || from.cell.isShadowed) ? (-0.2f) : 0f);
130 if ((bool)sr)
131 {
132 sr.material.SetVector("_Color", new Vector4(num, num, num, 1f));
133 }
134 }
135 fromV += posFix;
136 fromV.y += fixY;
137 if (to == null)
138 {
139 fromV += randomRange.Random();
140 }
141 this.fromV = fromV;
142 destPos = to ?? from;
143 base.transform.position = fromV;
144 if (randomFlip)
145 {
146 sr.flipX = EMono.rnd(2) == 0;
147 }
148 if (to != null)
149 {
150 float num2 = Mathf.Min(speed * (float)from.Distance(to), duration);
151 destV = to.Position() + posFix + randomRange.Random();
152 if (rotate)
153 {
154 base.transform.rotation = from.GetRotation(to);
155 }
156 moveTween = base.transform.DOMove(destV, num2).SetEase(Ease.Linear).SetDelay(startDelay);
157 }
158 Activate();
159 OnPlay();
160 OnUpdate();
161 return this;
162 }
BaseTileMap tileMap
float _baseBrightness
Definition: BaseTileMap.cs:308
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:209
Point destPos
Definition: Effect.cs:76
virtual void OnPlay()
Definition: Effect.cs:205
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:238
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:179
ref Vector3 Position(int height)
Definition: Point.cs:524
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, 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 179 of file Effect.cs.

180 {
181 if (sprites.Length != 0 && type != Type.Firework)
182 {
183 sr.enabled = false;
184 }
185 manager.Add(this);
186 killTimer = TweenUtil.Tween(startDelay + duration + 0.01f + (float)sprites.Length * 0.01f, null, Kill);
187 }
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 279 of file Effect.cs.

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

References systems.

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

◆ Flip()

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

Definition at line 189 of file Effect.cs.

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

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

239 {
240 TweenUtil.KillTween(ref killTimer);
241 TweenUtil.KillTween(ref moveTween);
242 killed = true;
243 OnKill();
244 manager.Remove(this);
246 {
247 PoolManager.DespawnOrDestroy(base.transform);
248 }
249 else if ((bool)base.gameObject)
250 {
251 UnityEngine.Object.Destroy(base.gameObject);
252 }
253 }
void Remove(Effect e)
bool killed
Definition: Effect.cs:78
bool pool
Definition: Effect.cs:26
virtual void OnKill()
Definition: Effect.cs:255
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 267 of file Effect.cs.

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

References item, Material, and materialsToDestroy.

◆ OnDisable()

void Effect.OnDisable ( )
inline

Definition at line 259 of file Effect.cs.

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

References Kill(), and test.

◆ OnKill()

virtual void Effect.OnKill ( )
inlinevirtual

Reimplemented in EffectIRenderer.

Definition at line 255 of file Effect.cs.

256 {
257 }

Referenced by Kill().

◆ OnPlay()

virtual void Effect.OnPlay ( )
inlinevirtual

Reimplemented in EffectMeteor.

Definition at line 205 of file Effect.cs.

206 {
207 }

Referenced by _Play(), and Play().

◆ OnUpdate()

virtual void Effect.OnUpdate ( )
inlinevirtual

Reimplemented in EffectIRenderer.

Definition at line 209 of file Effect.cs.

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

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

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

◆ Play() [3/3]

Effect Effect.Play ( Vector3  v)
inline

Definition at line 164 of file Effect.cs.

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

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

◆ SetParticleColor() [1/2]

Effect Effect.SetParticleColor ( Color  c)
inline

Definition at line 289 of file Effect.cs.

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

References systems.

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

◆ SetParticleColor() [2/2]

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

Definition at line 300 of file Effect.cs.

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

References material, Material, materialsToDestroy, and systems.

◆ SetScale()

Effect Effect.SetScale ( float  a)
inline

Definition at line 324 of file Effect.cs.

325 {
326 base.transform.localScale *= a;
327 return this;
328 }

◆ SetStartDelay()

Effect Effect.SetStartDelay ( float  a)
inline

Definition at line 199 of file Effect.cs.

200 {
201 startDelay = a;
202 return this;
203 }

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: