1
This commit is contained in:
34
unity/Assets/Script/LotterySystem/UIlottertOpen.cs
Normal file
34
unity/Assets/Script/LotterySystem/UIlottertOpen.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Manager;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIlottertOpen : MonoBehaviour
|
||||
{
|
||||
private Animator animator;
|
||||
private bool isOpen=true;
|
||||
private void Awake()
|
||||
{
|
||||
animator = GetComponentInChildren<Animator>();
|
||||
}
|
||||
private void OnTriggerStay2D(Collider2D collision)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.E)&&isOpen)
|
||||
{
|
||||
Debug.Log("Open Box");
|
||||
isOpen = false;
|
||||
animator.Play("Box");
|
||||
SoundManager.Instance.PlaySound(SoundDefine.BoxOpen);
|
||||
StartCoroutine(nameof(Open));
|
||||
}
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
StopCoroutine(nameof(Open));
|
||||
}
|
||||
IEnumerator Open()
|
||||
{
|
||||
yield return new WaitForSeconds(1.2f);
|
||||
UIManager.Instance.Show<UILottery>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user