ToriaAssets/Imports/RPG and MMO UI 9/Scripts/Test Scripts/Test_UISpellSlot_AssignAll.cs
2026-05-06 15:07:56 +02:00

35 lines
879 B
C#

using UnityEngine;
namespace DuloGames.UI
{
public class Test_UISpellSlot_AssignAll : MonoBehaviour
{
[SerializeField] private Transform m_Container;
void Start()
{
if (this.m_Container == null || UISpellDatabase.Instance == null)
{
this.Destruct();
return;
}
UISpellSlot[] slots = this.m_Container.gameObject.GetComponentsInChildren<UISpellSlot>();
UISpellInfo[] spells = UISpellDatabase.Instance.spells;
if (slots.Length > 0 && spells.Length > 0)
{
foreach (UISpellSlot slot in slots)
slot.Assign(spells[Random.Range(0, spells.Length)]);
}
this.Destruct();
}
private void Destruct()
{
DestroyImmediate(this);
}
}
}