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.
50 lines
1020 B
50 lines
1020 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class item : MonoBehaviour
|
|
{
|
|
public bool inBox = true;
|
|
public GameObject target;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void pick()
|
|
{
|
|
if (inBox)
|
|
{
|
|
transform.SetParent(GameObject.Find("Bag").transform);
|
|
inBox = false;
|
|
}
|
|
else
|
|
{
|
|
if(Camera.main.GetComponent<Player>().inTarget) {
|
|
int i = target.GetComponent<SetItem>().i;
|
|
if(i<= target.transform.childCount)
|
|
{
|
|
|
|
target.transform.GetChild(i).gameObject.SetActive(true);
|
|
target.GetComponent<SetItem>().i=i+1;
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|