X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=2DGame%2FAssets%2FScripts%2FMaus%2FCheese.cs;h=bfebef807979884f559f1a538aa7bca2e3fe5753;hb=84db97ac3843703acbd659b797bef164dc4f472f;hp=a31e4c3c80b3a2d8f203a5913b7bb91265ebf34a;hpb=597e1d092c37851ec6fc06e7f8ade10a0c996232;p=SuperMouseAdventure.git diff --git a/2DGame/Assets/Scripts/Maus/Cheese.cs b/2DGame/Assets/Scripts/Maus/Cheese.cs index a31e4c3..bfebef8 100644 --- a/2DGame/Assets/Scripts/Maus/Cheese.cs +++ b/2DGame/Assets/Scripts/Maus/Cheese.cs @@ -6,7 +6,14 @@ using UnityEngine.UI; public class Cheese : MonoBehaviour { public Text countText; - private int cheesecount; + + [HideInInspector] + public int cheesecount; + + void Start() + { + countText.text = "0"; + } private void OnTriggerEnter2D(Collider2D collision) { @@ -16,11 +23,13 @@ public class Cheese : MonoBehaviour SetCountText(); + FindObjectOfType().Play("cheese_plop"); + collision.gameObject.SetActive(false); } } - void SetCountText() + public void SetCountText() { countText.text = cheesecount.ToString(); }