]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Collectibles.cs
Sammelbarer Kaese
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Collectibles.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
5
6 public class Collectibles : MonoBehaviour
7 {
8     public Text countText;
9     private int cheesecount;
10
11     private void OnTriggerEnter2D(Collider2D collision)
12     {
13         if (collision.gameObject.CompareTag("Cheese"))
14         {
15             collision.gameObject.SetActive(false);
16
17             cheesecount++;
18
19             SetCountText();
20         }
21     }
22
23     void SetCountText()
24     {
25         countText.text = cheesecount.ToString();
26     }
27 }