Project_WL/Assets/Script/UI/Common/BoxOpenUI.cs

42 lines
1.0 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoxOpenUI : MonoBehaviourSingletonTemplateBackKeyAdd<BoxOpenUI>
{
public GameObject[] gos; // 0 카메라, 1 아이템 박스, 2 황금 박스, 3 해골보석 박스
Action m_act;
protected override void Awake()
{
base.Awake();
DontDestroy();
}
public void Set(int _box, Action _act)
{
base.Set();
OptionInfo.Ins.Set_Light(false);
DSUtil.InActivateGameObjects(gos);
gos[0].SetActive(true);
gos[_box].SetActive(true);
m_act = _act;
StartCoroutine(Co_Anim());
}
IEnumerator Co_Anim()
{
SoundInfo.Ins.Play_OneShot(eSound.s005_BoxOpen, 0.15f);
yield return new WaitForSeconds(4.2f);
OnClick_Back();
}
public override void OnClick_Back()
{
base.OnClick_Back();
DSUtil.InActivateGameObjects(gos);
m_act?.Invoke();
OptionInfo.Ins.Set_Light(true);
}
}