Commit 3b58ac64 authored by Martin Mihálik's avatar Martin Mihálik 🔥
Browse files

Rubble Spawning Fix

parent 614160d0
...@@ -55,10 +55,10 @@ public class MeteorController : MonoBehaviour ...@@ -55,10 +55,10 @@ public class MeteorController : MonoBehaviour
private void Explode() private void Explode()
{ {
Disappear();
SpawnExplosion(gameObject.transform.position, 2f, 4f, gameObject.transform.parent); SpawnExplosion(gameObject.transform.position, 2f, 4f, gameObject.transform.parent);
SpawnRubble(3, gameObject.transform.position, 200f, gameObject.transform.parent); SpawnRubble(3, gameObject.transform.position, m_Collider.bounds.extents, 300f, gameObject.transform.parent);
Disappear();
} }
private void Disappear() private void Disappear()
...@@ -77,11 +77,11 @@ public class MeteorController : MonoBehaviour ...@@ -77,11 +77,11 @@ public class MeteorController : MonoBehaviour
controller.m_GrowthRate = growthRate; controller.m_GrowthRate = growthRate;
} }
private void SpawnRubble(uint count, Vector2 basePosition, float force, Transform parent) private void SpawnRubble(uint count, Vector2 basePosition, Vector2 bbox, float force, Transform parent)
{ {
for (uint i = 0; i < count; ++i) for (uint i = 0; i < count; ++i)
{ {
var offset = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)); var offset = new Vector2(Random.Range(-bbox.x / 2, bbox.x / 2), Random.Range(-bbox.y / 2, bbox.y / 2));
var startingPoint = basePosition + offset; var startingPoint = basePosition + offset;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment