public void Mission() { // Item Collect var itemcollect = new ItemCollect(this, "sb/avatars/Moecho.png", 0.2f, 2000, 100, 450, "items/artifacts", 0.8f, 410, 460, true, 262781, 283671, ThemeColor, 3000, 6500); }
public void ItemCollect() { // Item Collect var itemcollect = new ItemCollect(this, "sb/avatars/Acyl.png", 0.25f, 4000, 620, 470, "items", 1, 380, 450, false, 128262, 157062, ThemeColor, 2000, 6000); }
private void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Player") { ItemCollect potion = collider.gameObject.GetComponent <ItemCollect>(); potion.CollectPowerUp(); Destroy(gameObject, 0f); } }
private void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Player") { ItemCollect meat = collider.gameObject.GetComponent <ItemCollect>(); meat.CollectMeat(); Destroy(gameObject, 0f); } }
// When enter trigger // Call Collect function from player // Destroy gameobject private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { ItemCollect diamondCollect = other.gameObject.GetComponent <ItemCollect>(); diamondCollect.CollectDiamond(); Destroy(gameObject, 0f); } }
void OnDisable() { for (int i = 0; i < interruption.difficulty; i++) { collect = spawnObjects[i].GetComponent <ItemCollect>(); if (collect != null) { collect.OnCollected -= HandleCollect; } } }
public void AddItem(ItemCollect newItem) { item = newItem; // Image of item icon.sprite = item.icon; icon.enabled = true; // How many are in inventory count += 1; itemCount.text = count.ToString(); itemCount.enabled = true; removeButton.interactable = true; }
void SetUpEnemies() { for (int i = 0; i < interruption.difficulty; i++) { spawnObjects[i].SetActive(false); health = spawnObjects[i].GetComponent <HealthController>(); if (health != null) { spawnObjects[i].GetComponent <HealthController>().IsDead = true; } collect = spawnObjects[i].GetComponent <ItemCollect>(); if (collect != null) { collect.OnCollected += HandleCollect; } } }
// Processes picked up items public void processItem(string name, ItemCollect item = null) { switch (name) { // Found Journal case "Journal": gmScr.journal = true; J_OpenClose.SetActive(true); break; // Scuba Mask case "Goggles": GetComponent <CountdownTimer>().FoundMask(); break; // All other items at the moment default: UpdateUI(item); break; } }
public void OnTriggerStay2D(Collider2D other) { if (Input.GetKeyDown("x")) { if (gameObject.tag.Equals("questr") && needsItem) { if (ItemCollect.getCollected()) { QuestList.completeQuest(quest_tag); MenuNav.removeItemFromInventory(); } else { PlayLog(); } } else { PlayLog(); } } }
// Remove item from recipe public bool RemoveItem(ItemCollect item) { // At least one item was removed bool success = false; // Loop through the recipe for (int i = 0; i < recipe.Count; ++i) { // Check if item is in recipe //Debug.Log("Looking at: " + recipe[i]); if (recipe[i].Identity == item.Identity) { // Remove the item from the recipe recipe.Remove(recipe[i]); //Debug.Log("Removed: " + item.Identity); // Play sound if (useRight) { soundSource.PlayOneShot(useRight, 1); } // A item was removed success = true; break; } } if (stepBuild && success) { // 'Build' step amount of items index = ToggleStep(index); } if (recipe.Count == 0) { // 'Build' all unbuilt items ToggleItems(index); } return(success); }
void UpdateUI(ItemCollect item) { // Loop through all slots for (int i = 0; i < gmScr.slots.Length; i++) { // Variable for easier referencing InventorySlot slot = gmScr.slots[i]; // Item already in a slot if (!slot.CheckSlot() && slot.GetItem().Identity == item.Identity) { slot.ChangeCount(1); return; } // Empty slot else if (slot.CheckSlot()) { slot.AddItem(item); return; } } // All slots full item.gameObject.SetActive(true); // TODO add inventory full message }