]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Maus/Cheese.cs
Invincibility Frames v2.0 und neue Soundeffekte
[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     private int cheesecount;
10
11     void Start()
12     {
13         countText.text = "0";
14     }
15
16     private void OnTriggerEnter2D(Collider2D collision)
17     {
18         if (collision.gameObject.CompareTag("Cheese"))
19         {
20             cheesecount++;
21
22             SetCountText();
23
24             FindObjectOfType<AudioManager>().Play("cheese_plop");
25
26             collision.gameObject.SetActive(false);
27         }
28     }
29
30     void SetCountText()
31     {
32         countText.text = cheesecount.ToString();
33     }
34 }