using GUPS.AntiCheat.Protected; using GUPS.AntiCheat.Protected.Collection; using System; using TMPro; using UnityEngine; using UnityEngine.UI; using Random = UnityEngine.Random; public enum eRandomBlock { Minus, Plus, Multiplier, Divide } public class LuckyRandomBlock : MonoBehaviour { public Image i_bg; public TextMeshProUGUI t_value; eRandomBlock m_BlockType; ProtectedInt32 m_Value; float MoveSpeed; ProtectedList list_value = new ProtectedList { 1, 2, 3, 4, 5 }; public void Set() { // BlockType 랜덤 (Enum 전체 범위에서 선택) int typeCount = Enum.GetValues(typeof(eRandomBlock)).Length; m_BlockType = (eRandomBlock)Random.Range(0, typeCount); // Value 랜덤 (리스트에서 하나 뽑기) int randIndex = Random.Range(0, list_value.Count); m_Value = list_value[randIndex]; switch (m_BlockType) { case eRandomBlock.Minus: t_value.text = $"-{m_Value}"; i_bg.color = Color.red; break; case eRandomBlock.Plus: t_value.text = $"+{m_Value}"; i_bg.color = Color.blue; break; case eRandomBlock.Multiplier: t_value.text = $"x{m_Value}"; i_bg.color = Color.green; break; case eRandomBlock.Divide: t_value.text = $"/{m_Value}"; i_bg.color = Color.grey; break; } MoveSpeed = Random.Range(2f, 5f); } public int Get_Value(int amount) { switch (m_BlockType) { case eRandomBlock.Minus: return amount - m_Value; case eRandomBlock.Plus: return amount + m_Value; case eRandomBlock.Multiplier: return amount * m_Value; case eRandomBlock.Divide: return amount / m_Value; } return 0; } }