Untitled
unknown
plain_text
a month ago
1.3 kB
2
Indexable
Never
using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class OyuncuDegerleri : MonoBehaviour { public int para; public TextMeshProUGUI paraYazisi; //Oyuncunun canı, oyuncunun açtığı oda sayısı... vesaire. public static OyuncuDegerleri instance; private void Awake() { instance = this; } void Start() { } // Update is called once per frame void Update() { paraYazisi.text = "Para: " + para.ToString(); } } using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Sandik : MonoBehaviour { Animator animator; bool isOpened; private void Awake() { animator = GetComponent<Animator>(); } private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Oyuncu")) { if(isOpened) { return; } else { OpenChest(); } } } private void OpenChest() { animator.SetTrigger("Open"); OyuncuDegerleri.instance.para += 100; isOpened = true; } }
Leave a Comment