You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
550 B
29 lines
550 B
2 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using TMPro;
|
||
|
|
||
|
|
||
|
public class CheeseCollector : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
private int Cheese = 0;
|
||
|
|
||
|
[SerializeField] private TMP_Text CheeseText;
|
||
|
|
||
|
private void OnTriggerEnter2D(Collider2D collision)
|
||
|
{
|
||
|
if (collision.gameObject.CompareTag("Cheese"))
|
||
|
{
|
||
|
Destroy(collision.gameObject);
|
||
|
Cheese++;
|
||
|
Debug.Log("Cheese:" + Cheese);
|
||
|
CheeseText.text = "Cheese:" + Cheese;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|