Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
RigidExplode Class Reference
Inheritance diagram for RigidExplode:
RigidUpdate EMono

Public Member Functions

void Explode ()
 
override void OnFixedUpdate ()
 
virtual void OnFixedUpdate ()
 

Public Attributes

ParticleSystem particle
 
float force = 20f
 
float radius = 2.5f
 
float intervalMin = 5f
 
float intervalMax = 30f
 
float massPower = 0.1f
 
float chance = 0.8f
 
bool repeat
 
bool destroy = true
 
string sound = "explode"
 
- Public Attributes inherited from RigidUpdate
Rigidbody2D rb
 
bool active = true
 
CollectibleActor _actor
 

Private Member Functions

void Start ()
 

Private Attributes

float time
 
float interval = 1f
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from RigidUpdate
static float delta
 
static float leftX
 
static float rightX
 
- Static Public Attributes inherited from EMono
static Core core
 
- Properties inherited from RigidUpdate
CollectibleActor actor [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]
 

Detailed Description

Definition at line 3 of file RigidExplode.cs.

Member Function Documentation

◆ Explode()

void RigidExplode.Explode ( )
inline

Definition at line 34 of file RigidExplode.cs.

35 {
36 Vector2 position = rb.position;
37 if ((bool)particle)
38 {
39 ParticleSystem p = Object.Instantiate(particle);
40 p.transform.position = position;
41 TweenUtil.Delay(5f, delegate
42 {
43 if ((bool)p && (bool)p.gameObject)
44 {
45 Object.DestroyImmediate(p.gameObject);
46 }
47 });
48 }
49 RaycastHit2D[] array = Physics2D.CircleCastAll(position, radius, Vector3.forward);
50 foreach (RaycastHit2D raycastHit2D in array)
51 {
52 Rigidbody2D component = raycastHit2D.collider.GetComponent<Rigidbody2D>();
53 if ((bool)component)
54 {
55 Vector2 vector = component.position - position;
56 component.AddForce(vector * force * (1f + component.mass * massPower), ForceMode2D.Impulse);
57 }
58 }
59 if (!sound.IsEmpty())
60 {
61 EMono.Sound.Play(sound, rb.position);
62 }
63 }
Definition: EMono.cs:4
static SoundManager Sound
Definition: EMono.cs:39
float massPower
Definition: RigidExplode.cs:15
string sound
Definition: RigidExplode.cs:23
ParticleSystem particle
Definition: RigidExplode.cs:5
float radius
Definition: RigidExplode.cs:9
Rigidbody2D rb
Definition: RigidUpdate.cs:13

References force, massPower, particle, radius, RigidUpdate.rb, EMono.Sound, and sound.

Referenced by OnFixedUpdate().

◆ OnFixedUpdate()

override void RigidExplode.OnFixedUpdate ( )
inlinevirtual

Reimplemented from RigidUpdate.

Definition at line 65 of file RigidExplode.cs.

66 {
68 if (!(time > interval))
69 {
70 return;
71 }
72 if (chance >= Random.Range(0f, 1f))
73 {
74 Explode();
75 if (destroy)
76 {
77 active = false;
78 CollectibleActor component = base.gameObject.GetComponent<CollectibleActor>();
79 if ((bool)component)
80 {
81 component.Deactivate();
82 }
83 else
84 {
85 base.gameObject.SetActive(value: false);
86 }
87 return;
88 }
89 }
90 if (repeat)
91 {
92 time = 0f;
93 }
94 else
95 {
96 active = false;
97 }
98 }
void Explode()
Definition: RigidExplode.cs:34
float interval
Definition: RigidExplode.cs:27
static float delta
Definition: RigidUpdate.cs:6

References RigidUpdate.active, chance, CollectibleActor.Deactivate(), RigidUpdate.delta, destroy, Explode(), interval, Random, repeat, and time.

◆ Start()

void RigidExplode.Start ( )
inlineprivate

Definition at line 29 of file RigidExplode.cs.

30 {
32 }
float intervalMin
Definition: RigidExplode.cs:11
float intervalMax
Definition: RigidExplode.cs:13

References interval, intervalMax, intervalMin, and Random.

Member Data Documentation

◆ chance

float RigidExplode.chance = 0.8f

Definition at line 17 of file RigidExplode.cs.

Referenced by OnFixedUpdate().

◆ destroy

bool RigidExplode.destroy = true

Definition at line 21 of file RigidExplode.cs.

Referenced by OnFixedUpdate().

◆ force

float RigidExplode.force = 20f

Definition at line 7 of file RigidExplode.cs.

Referenced by Explode().

◆ interval

float RigidExplode.interval = 1f
private

Definition at line 27 of file RigidExplode.cs.

Referenced by OnFixedUpdate(), and Start().

◆ intervalMax

float RigidExplode.intervalMax = 30f

Definition at line 13 of file RigidExplode.cs.

Referenced by Start().

◆ intervalMin

float RigidExplode.intervalMin = 5f

Definition at line 11 of file RigidExplode.cs.

Referenced by Start().

◆ massPower

float RigidExplode.massPower = 0.1f

Definition at line 15 of file RigidExplode.cs.

Referenced by Explode().

◆ particle

ParticleSystem RigidExplode.particle

Definition at line 5 of file RigidExplode.cs.

Referenced by Explode().

◆ radius

float RigidExplode.radius = 2.5f

Definition at line 9 of file RigidExplode.cs.

Referenced by Explode().

◆ repeat

bool RigidExplode.repeat

Definition at line 19 of file RigidExplode.cs.

Referenced by OnFixedUpdate().

◆ sound

string RigidExplode.sound = "explode"

Definition at line 23 of file RigidExplode.cs.

Referenced by Explode().

◆ time

float RigidExplode.time
private

Definition at line 25 of file RigidExplode.cs.

Referenced by OnFixedUpdate().


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