Scriptum/Assets/Scripts/Objects/GoldOre.cs

40 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-06-16 20:00:19 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
2022-06-16 20:00:19 +02:00
public class GoldOre : MonoBehaviour
{
[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()
{
GameObject globalGUI = GameObject.FindGameObjectsWithTag("GUI")[0];
if(globalGUI)
{
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;
2022-12-06 01:58:32 +01:00
Debug.Log(goldOre.name);
droppedItem.GetComponent<PickableController>().item.name = goldOre.name;
//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!!!");
}
}
}