Untitled
unknown
plain_text
a year ago
1.3 kB
12
Indexable
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;
}
}
Editor is loading...
Leave a Comment