public void Burning() { if (active) { // Get all surrounding objects Collider[] closeObjects = Physics.OverlapSphere( transform.position * Random.Range(0.6f, 1.3f), parent.radius * Random.Range(0.2f, 1.0f)); foreach (Collider obj in closeObjects) { // Check if it collides with itself if (obj.collider != transform.collider && obj.collider != parent.collider) { Flammable flammable = obj.GetComponent <Flammable>(); FireCell cell = obj.GetComponent <FireCell>(); // Is it a FireCell? if (cell != null) { cell.FireDamage(); } // Is it a Flammable? else if (flammable != null) { flammable.RespondToFire(); } } } } }