public void AddItem(ISpawnableItem item, SpawnableInventoryPage page) { page.AddItem(item); if (SpawnableAdded != null) { SpawnableAdded(this, new SpawnableLoadedEventArgs(item, page)); } }
private void SpawnSelectedObects() { for (int i = 0; i < ClosetListContent.transform.childCount; i++) { var child = ClosetListContent.transform.GetChild(i); if (child.CompareTag(spawnableTag)) { Debug.Log("Getting item :" + child.ToString()); ISpawnableItem item = child.GetComponent <ISpawnableItem>(); item.onSpawn(); } } }
public void Initialize(ISpawnableItem item) { // Sets reference to label and hides it to start label = GetComponentInChildren <Text>(true); label.gameObject.SetActive(false); // Sets reference to icon image icon = transform.parent.Find("Image").GetComponentInChildren <Image>(); // Sets label text using spawnable item name label.text = item.Name; // Sets icon image using spawnable item icon icon.sprite = item.Image; // Sets SpawnableItem to given item this.item = item; }
public void SpawnItem(ISpawnableItem item) { itemInstance = item.Spawn(); itemInstance.transform.SetPositionAndRotation(transform.position, transform.rotation); // Snap item to grab position VRTK_ObjectAutoGrab autograb = GetComponent <VRTK_ObjectAutoGrab>(); if (autograb == null) { autograb = gameObject.AddComponent <VRTK_ObjectAutoGrab>(); } autograb.objectToGrab = itemInstance.GetComponent <VRTK_InteractableObject>(); // Disable UI pointer on spawn to avoid dragging menu gameObject.GetComponent <VRTK_UIPointer>().enabled = false; Destroy(autograb, 0.1f); }
public SpawnableItemsEventArgs(ISpawnableItem item) { Item = item; }
public SpawnableLoadedEventArgs(ISpawnableItem item, SpawnableInventoryPage page) { Item = item; Page = page; }
public void AddItem(ISpawnableItem item) { mItems.Add(item); }