]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Mouse/Cheese.cs
Dialogue-System v0.6
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Mouse / Cheese.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
5
6 public class Cheese : MonoBehaviour
7 {
8     public Text countText;
9     
10     [HideInInspector]
11     public int cheesecount;
12
13     public bool collected;
14
15     void Start()
16     {
17         countText.text = cheesecount.ToString();
18     }
19
20     private void OnTriggerEnter2D(Collider2D collision)
21     {
22         if (collision.gameObject.CompareTag("Cheese"))
23         {
24             cheesecount++;
25
26             SetCountText();
27
28             FindObjectOfType<AudioManager>().Play("cheese_plop");
29
30             collision.gameObject.SetActive(false);
31         }
32     }
33
34     public void SetCountText()
35     {
36         countText.text = cheesecount.ToString();
37     }
38 }