public void Open() { if (interactable.canInteract == false) { if (needKey == true) { //Key-=1; interactable.canInteract = true; Debug.Log("NEED KEY"); return; } if (itemInside == null) { itemInside = randItems.GetItem(false); } if (itemInside.GetComponent <Item>() != null) { itemInside.GetComponent <Item>().interactable.CanInteract(false); } itemInside.GetComponent <Item>().interactable.CanInteract(false); itemInside.transform.position = transform.position; itemInside.transform.parent = transform; itemInside.transform.localPosition = new Vector3(0, -0.4f, 0f); animator.SetBool("Open", true); StartCoroutine(playAnimation(itemInside)); } }
public void Start() { if (spawnItems) { randItems = GetComponent <RandomItems>(); if (randItems != null) { foreach (Transform p in positions) { // Debug.Log("Chance: " + GameManager.instance.items.rareWeapons.chance); GameObject g = randItems.GetItem(true); PlaceOnTable(g, p); } } } }