Skip to content

Instantly share code, notes, and snippets.

@Avonexile
Created November 13, 2018 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Avonexile/50552d17014652620c8db333b2ceeb30 to your computer and use it in GitHub Desktop.
Save Avonexile/50552d17014652620c8db333b2ceeb30 to your computer and use it in GitHub Desktop.
This show the crafting result if there is one
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace CraftingSystemRework
{
public class CraftResult : MonoBehaviour {
Image thisImage;
public Color see, dontSee;
ItemDataBase itemDB;
CraftManager craftManager;
public int resultID;
//sets references
void Awake ()
{
craftManager = GameObject.Find("_Managers").GetComponent<CraftManager>();
itemDB = GameObject.Find("_Managers").GetComponent<ItemDataBase>();
thisImage = GetComponent<Image>();
thisImage.color = dontSee;
}
//shows the result in the result slot
public void ShowResult (int itemResultID)
{
resultID = itemResultID;
thisImage.sprite = itemDB.items[itemResultID].itemImage;
thisImage.color = see;
craftManager.ready = true;
}
//hides the result
public void HideResult ()
{
thisImage.color = dontSee;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment