]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Maus/Cheese.cs
SaveSystem v0.1 NICHT FUNKTIONAL!!!
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Maus / 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     void Start()
14     {
15         countText.text = "0";
16     }
17
18     private void OnTriggerEnter2D(Collider2D collision)
19     {
20         if (collision.gameObject.CompareTag("Cheese"))
21         {
22             cheesecount++;
23
24             SetCountText();
25
26             FindObjectOfType<AudioManager>().Play("cheese_plop");
27
28             collision.gameObject.SetActive(false);
29         }
30     }
31
32     public void SetCountText()
33     {
34         countText.text = cheesecount.ToString();
35     }
36 }