PatronSelectorUI

Overview

Picker that cycles through a grid of Patron portraits stored in Resources/Patrons/…. Animates the previous image out and the next image in with fade & slide, and offsets the index by the currently selected personality to show the matching portrait variant.

Serialized

  • IntVariable selectedPatron, selectedPersonality
  • GameObject patronPrefab (contains an Image)
  • Button leftButton, rightButton
  • Transform patronImagesParent

Behavior

  • Start()
    • LoadPatrons()Resources.LoadAll<Sprite>(patronDataPath) then instantiates one prefab per sprite under patronImagesParent.
    • Registers OnPersonalityChanged() to animate the previous and current images when personality changes.
  • OnLeftButtonPressed() / OnRightButtonPressed()
    • Guard against double-taps while tweens with a _busy flag and a shared tween id.
    • Slides/fades the current image out, updates selectedPatron by ±3 (wrap-around), and brings the next image in to the focus position.
  • SafeIndex(int i) wraps indexes for any list length.

public static string patronDataPath = "Patrons\\"; (ensure sprites are in this folder).