summaryrefslogtreecommitdiff
path: root/GameCode/TreasureUI.cs
blob: c0e297fffc8ca7997c12bd8e51046e5a9ef6b852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;

public class TreasureUI : MonoBehaviour
{
	public GameObject myChest;

	private int cardDraw = 2;

	private void Start()
	{
		UIManager.instance.SetNewUI(base.gameObject);
		cardDraw = 2 + PlayerPrefs.GetInt("TreasureDraw1", 0);
	}

	public void Open()
	{
		SFXManager.instance.PlaySound(Sound.CritBig, myChest.transform.position);
		for (int i = 0; i < myChest.GetComponent<TreasureChest>().numberOfDrops; i++)
		{
			CardManager.instance.DrawCards(cardDraw);
		}
		Die();
	}

	public void Die()
	{
		Object.Destroy(myChest);
		UIManager.instance.CloseUI(base.gameObject);
	}
}