From 828bb7117f5625b48b2b2119e49f24aa16f32fc9 Mon Sep 17 00:00:00 2001 From: Kennedy793 Date: Fri, 5 Dec 2025 23:54:04 +1000 Subject: [PATCH] ## Overview This pull request adds two new C# scripts that implement the core logic for the Totem Selection System. These scripts are responsible for spawning the totem selection buttons at runtime and handling user interactions when a totem is chosen. These files are foundational parts of the feature and will be referenced by the UI prefab and scene setup, which will be committed separately. --- ## Added Files - Assets/Scripts/UI/TotemTokenManager.cs - Spawns 8 totem buttons at game start - Assigns sprites and handles player selection - Tracks the currently selected totem - Assets/Scripts/UI/TotemTokenButton.cs - Handles individual button behavior - Controls highlight state when selected - Receives callbacks from the manager ## Overview This pull request adds two new C# scripts that implement the core logic for the Totem Selection System. These scripts are responsible for spawning the totem selection buttons at runtime and handling user interactions when a totem is chosen. These files are foundational parts of the feature and will be referenced by the UI prefab and scene setup, which will be committed separately. --- ## Added Files - Assets/Scripts/UI/TotemTokenManager.cs - Spawns 8 totem buttons at game start - Assigns sprites and handles player selection - Tracks the currently selected totem - Assets/Scripts/UI/TotemTokenButton.cs - Handles individual button behavior - Controls highlight state when selected - Receives callbacks from the manager --- Assets/Scripts/UI/TotemTokenButton.cs | 45 +++++++++++++++++++ Assets/Scripts/UI/TotemTokenManager.cs | 60 ++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 Assets/Scripts/UI/TotemTokenButton.cs create mode 100644 Assets/Scripts/UI/TotemTokenManager.cs diff --git a/Assets/Scripts/UI/TotemTokenButton.cs b/Assets/Scripts/UI/TotemTokenButton.cs new file mode 100644 index 00000000..a93072a4 --- /dev/null +++ b/Assets/Scripts/UI/TotemTokenButton.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using UnityEngine.UI; +using System; + +[RequireComponent(typeof(Button))] +public class TotemTokenButton : MonoBehaviour +{ + public int Index { get; private set; } = -1; + + [SerializeField] private Image tokenImage; + [SerializeField] private Image highlightImage; + private Button button; + private Action onSelected; + + private void Awake() + { + button = GetComponent