2022-06-16 20:00:19 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2022-06-17 22:22:19 +02:00
|
|
|
using System;
|
2022-06-16 20:00:19 +02:00
|
|
|
|
|
|
|
public class GoldOre : MonoBehaviour
|
|
|
|
{
|
2022-06-17 22:22:19 +02:00
|
|
|
[SerializeField] public GameObject goldOre;
|
2022-06-16 20:00:19 +02:00
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DropItem()
|
|
|
|
{
|
2023-01-06 03:44:07 +01:00
|
|
|
GameObject globalGUI = GameObject.FindGameObjectWithTag("ItemCollection");
|
2022-06-16 20:00:19 +02:00
|
|
|
|
|
|
|
if(globalGUI)
|
|
|
|
{
|
2022-06-17 22:22:19 +02:00
|
|
|
GameObject droppedItem = Instantiate(goldOre, gameObject.transform.position, Quaternion.identity, globalGUI.transform);
|
|
|
|
// Object and also ith binded piclable object gets "(Clone)" to its names - we must cut it
|
|
|
|
droppedItem.name = goldOre.name;
|
2023-01-06 03:44:07 +01:00
|
|
|
droppedItem.transform.localScale = new Vector3(1, 1, 1);
|
|
|
|
|
|
|
|
//droppedItem.GetComponent<PickableController>().item.name = goldOre.name;
|
2022-06-17 22:22:19 +02:00
|
|
|
//droppedItem.GetComponent<PickableController>().HandleIndexInScelenObjectList =
|
|
|
|
SceneEquippableItemManager.Instance.AddDynamicItem(droppedItem);
|
|
|
|
|
2022-06-16 20:00:19 +02:00
|
|
|
} else {
|
|
|
|
Debug.Log("Can't find global GUI object!!!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|