41 lines
907 B
C#
41 lines
907 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SpecialPrizeToggler : MonoBehaviour
|
|
{
|
|
Coroutine coroutine;
|
|
[SerializeField] List<Graphic> graphics;
|
|
|
|
[SerializeField] Color enabledColor;
|
|
[SerializeField] Color disabledColor;
|
|
|
|
private void OnEnable() => StartCoroutine(Check());
|
|
|
|
private void OnDisable() => StopAllCoroutines();
|
|
|
|
|
|
IEnumerator Check()
|
|
{
|
|
while (true)
|
|
{
|
|
SetVisibilityBySettings();
|
|
yield return new WaitForSeconds(5);
|
|
}
|
|
}
|
|
|
|
void SetVisibilityBySettings()
|
|
{
|
|
bool visibility = PrizeSerializer.GetPrizes()[^1].PrizeType == PrizeType.Special;
|
|
|
|
Color color = visibility ? enabledColor : disabledColor;
|
|
|
|
foreach(var g in graphics)
|
|
{
|
|
g.color = color;
|
|
}
|
|
}
|
|
}
|