Posted January 29, 2018 by Hopeless
script that we use for pop up the item that we get :using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class kardus : MonoBehaviour {
public GameObject dapatLentera;
bool freeze;
// Use this for initialization
void Start () {
freeze = false;
dapatLentera.SetActive (false);
}
// Update is called once per frame
void Update () {
if (freeze) {
Time.timeScale = 0;
} else {
Time.timeScale = 1;
dapatLentera.SetActive (false);
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.tag == "Player")
{
charMoving.stay = true;
}
}
void OnMouseDown(){
if(charMoving.stay == true){
UIInventory.have2 = true;
dapatLentera.SetActive (true);
freeze = !freeze;
}
}
}