-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chest.cs
44 lines (40 loc) · 1.16 KB
/
Chest.cs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Chest : MonoBehaviour, Interactables
{
Canvas chest_canvas;
bool chest_is_closed;
Item dropped_item;
pinball_recall pinball_recall;
private void Start()
{
chest_canvas = GameObject.FindGameObjectWithTag("Chest").GetComponentInChildren<Canvas>();
chest_is_closed = true;
pinball_recall = FindObjectOfType<pinball_recall>();
}
public void Finish_Game(bool isCorrect)
{
if (isCorrect)
{
Instantiate(Resources.Load("Items/key"), transform.position, transform.rotation);
}
Destroy(gameObject);
}
public void open_chest(Player player)
{
#region old codes
//chest_canvas.enabled = true;
//chest_canvas.GetComponentInChildren<Button>().onClick.AddListener(get_item);
//chest_is_closed = false;
#endregion
#region open minigame
pinball_recall.Start_Game(3,3, player.transform.position, this);
#endregion
}
public void interact(Player player)
{
open_chest(player);
}
}