public void SpawnShards(Vector2 direction, float minAngle, float maxAngle, float verticalSpeed, float minMagnitude, float maxMagnitude) { Vector3 position = specRigidbody.GetUnitCenter(ColliderType.HitBox); if (shardClusters != null && shardClusters.Length > 0) { int num = Random.Range(0, 10); for (int i = 0; i < shardClusters.Length; i++) { ShardCluster shardCluster = shardClusters[i]; int num2 = Random.Range(shardCluster.minFromCluster, shardCluster.maxFromCluster + 1); int num3 = Random.Range(0, shardCluster.clusterObjects.Length); for (int j = 0; j < num2; j++) { float lowDiscrepancyRandom = BraveMathCollege.GetLowDiscrepancyRandom(num); num++; float z = Mathf.Lerp(minAngle, maxAngle, lowDiscrepancyRandom); Vector3 vector = Quaternion.Euler(0f, 0f, z) * (direction.normalized * Random.Range(minMagnitude, maxMagnitude)).ToVector3ZUp(verticalSpeed); int num4 = (num3 + j) % shardCluster.clusterObjects.Length; GameObject gameObject = SpawnManager.SpawnDebris(shardCluster.clusterObjects[num4].gameObject, position, Quaternion.identity); tk2dSprite component = gameObject.GetComponent <tk2dSprite>(); if (sprite.attachParent != null && component != null) { component.attachParent = sprite.attachParent; component.HeightOffGround = sprite.HeightOffGround; } DebrisObject component2 = gameObject.GetComponent <DebrisObject>(); vector = Vector3.Scale(vector, shardCluster.forceAxialMultiplier) * shardCluster.forceMultiplier; component2.Trigger(vector, heightOffGround, shardCluster.rotationMultiplier); } } } }