Created
November 13, 2018 16:34
-
-
Save Avonexile/50552d17014652620c8db333b2ceeb30 to your computer and use it in GitHub Desktop.
This show the crafting result if there is one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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