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.
41 lines
880 B
41 lines
880 B
using StarterAssets;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class TakeItem : MonoBehaviour
|
|
{
|
|
public GameObject ui;
|
|
public GameObject box;
|
|
public GameObject bag;
|
|
public GameObject Player;
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Player") {
|
|
ui.SetActive(true);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Player")
|
|
{
|
|
ui.SetActive(false);
|
|
box.SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerStay(Collider other)
|
|
{
|
|
if(Input.GetKeyDown(KeyCode.E))
|
|
{
|
|
box.SetActive(!box.activeInHierarchy);
|
|
if(box.activeInHierarchy)
|
|
{
|
|
bag.SetActive(true);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|