RewardBubbleSpawner

Overview

Tick-driven spawner that periodically creates RewardBubbles near valid Regions. Plays an optional appear SFX and randomly selects a reward type each time.

References

  • RewardBubble bubble
  • BoolVariable paused (not used for timing here, lifetime is paused inside the bubble)
  • SFXSingle appearSFX

Timing

  • spawnRate: [min,max] ticks between spawns (defaults 3..5).
  • biasK (FloatReference): biases toward higher delays; k >= 1 and bigger → more high-end bias.
  • Every Tick(): increment a counter; when it reaches a target, spawn and pick a new target via NextTimer(min,max):
    float u = Random.value^(1/k);
    return ceil(lerp(min, max, u));
    

Spawn Placement

  • Picks a random Region that has Presence == true or Control >= 1.
  • Uses that Region’s Node.visualAnchor.position plus an optional offset to place the bubble.

Behavior

  • SpawnBubble(): plays SFX, selects a random RewardType, and calls bubble.Spawn(type, pos).

Cleanup

  • OnDestroy(): StopAllCoroutines() as a safety net.