Skip to content

Instantly share code, notes, and snippets.

@suakig
Created May 12, 2015 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save suakig/0a66666abb49a35172a6 to your computer and use it in GitHub Desktop.
Save suakig/0a66666abb49a35172a6 to your computer and use it in GitHub Desktop.
ItemButton.cs
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ItemButton : MonoBehaviour
{
public int price = 1000;
private Button itemButton;
void Awake ()
{
DeleGateAction.OnCoinChange += OnCoinChange;
itemButton = transform.GetComponent<Button> ();
DeleGateAction.CoinChange ();
}
private void OnCoinChange(int coin)
{
itemButton.interactable = coin >= price ? true : false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment