public static void Fire(GameObject prefab, int orderInLayer, Timer timer, CollisionData collisionData, float range = 0, float ttl = .25f, float size = 1, int damage = 1, AudioProperties audioProperties = null) { if (prefab == null) { return; } if (timer.count == 0) { return; } if (collisionData == null) { return; } var target = Targetable.GetClosest(collisionData, true, range); if (target == null) { return; } if (timer.Update() == false) { return; } var newLaser = Instantiate(prefab); // if (newLaser == null) return; var laserComponent = newLaser.GetComponent <Laser>(); if (laserComponent == null) { return; } laserComponent.Fire(orderInLayer, collisionData, target, ttl, size, damage); if (audioProperties != null) { audioProperties.Play(); } }