// Start is called before the first frame update void Start() { skinObj = GameObject.Find("SkinHandler").GetComponent <Skins>(); button = GetComponent <Button>(); button.onClick.AddListener(Buy); text = transform.GetChild(0).GetComponent <Text>(); //Auto set costs if (cost <= 0) { if (isTheme) { cost = Skins.themeCost; } else if (isSnake) { cost = Skins.skinCost; } } //Make sure there are actual skins/themes left to buy! if (isTheme) { if (Skins.HaveAllLevelThemes()) { GreyOutButton(); } } else { if (Skins.HaveAllSnakeSkins()) { GreyOutButton(); } } globalStats = GameObject.Find("LevelSpawner").GetComponent <GlobalStats>(); //Update price tag text.text = text.text.Replace(".", cost.ToString()); }
public void CheckForShopNotifications() { //Check if the player already owns everything. haveAllSnakeSkins = Skins.HaveAllSnakeSkins(); haveAllLevelThemes = Skins.HaveAllLevelThemes(); //Notify the player if they can buy a new skin if (GlobalStats.coins > Skins.skinCost && !haveAllSnakeSkins) { snakeSkinNotification.SetActive(true); } else { snakeSkinNotification.SetActive(false); } if (GlobalStats.coins > Skins.themeCost && !haveAllLevelThemes) { levelThemeNotification.SetActive(true); } else { levelThemeNotification.SetActive(false); } }