Roulette/Assets/Scripts/ChipBoard.cs

32 lines
788 B
C#

using System.Collections;
using System.Collections.Generic;
using EasyButtons;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class ChipBoard : MonoBehaviour
{
public Transform numberGridParent;
public Color redColor,blackColor;
[Button]
void Config(){
for(int i= 1; i < RouletteManager.RouletteNumbers.Length-1; i++){
GameObject newItem= Instantiate(numberGridParent.GetChild(0).gameObject, numberGridParent);
newItem.GetComponent<Image>().color = RouletteManager.Reds.Contains(i+1) ? redColor : blackColor;
newItem.GetComponentInChildren<TMP_Text>().text = (i+1).ToString();
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}