Scriptum/Assets/Scripts/Objects/GoldOre.cs
kabix09 602c94726a Add scene manager for items
Start rebuild Save & Load game system
2022-06-19 01:25:49 +02:00

39 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class GoldOre : MonoBehaviour
{
[SerializeField] public GameObject goldOre;
// 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;
droppedItem.GetComponent<PickableController>().item.name = goldOre.name;
//droppedItem.GetComponent<PickableController>().HandleIndexInScelenObjectList =
SceneEquippableItemManager.Instance.AddDynamicItem(droppedItem);
} else {
Debug.Log("Can't find global GUI object!!!");
}
}
}