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
private void Explode()
{
Disappear();
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()
......@@ -77,11 +77,11 @@ public class MeteorController : MonoBehaviour
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)
{
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;
......
Supports Markdown
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