10 this.interval = UnityEngine.Random.Range(this.intervalMin, this.intervalMax);
16 Vector2 position = this.rb.position;
19 ParticleSystem p = UnityEngine.Object.Instantiate<ParticleSystem>(this.particle);
20 p.transform.position = position;
21 TweenUtil.Delay(5f, delegate
23 if (p && p.gameObject)
25 UnityEngine.Object.DestroyImmediate(p.gameObject);
29 foreach (RaycastHit2D raycastHit2D
in Physics2D.CircleCastAll(position,
this.radius, Vector3.forward))
31 Rigidbody2D component = raycastHit2D.collider.GetComponent<Rigidbody2D>();
34 Vector2 a = component.position - position;
35 component.AddForce(a * this.force * (1f + component.mass *
this.massPower), ForceMode2D.Impulse);
38 if (!this.sound.IsEmpty())
40 EMono.Sound.Play(this.sound, this.rb.position, 1f);
45 public override void OnFixedUpdate()
48 if (this.time > this.interval)
50 if (this.chance >= UnityEngine.Random.Range(0f, 1f))
59 component.Deactivate();
62 base.gameObject.SetActive(
false);
76 public ParticleSystem particle;
79 public float force = 20f;
82 public float radius = 2.5f;
85 public float intervalMin = 5f;
88 public float intervalMax = 30f;
91 public float massPower = 0.1f;
94 public float chance = 0.8f;
100 public bool destroy =
true;
103 public string sound =
"explode";
109 private float interval = 1f;