new public void Unlock() { bool unlockSucceeded = backgroundData.Unlock(false); if (unlockSucceeded) { unlockImage.SetActive(false); PopUpController.Instance.HidePopUp(); SoundManager.Instance.PlaySound(SoundManager.Instance.unlock); OnClickChange(); } }
public void GridLayoutBackGround() { for (int i = 0; i < BackGroundManager.Instance.backGroundFrame.Length; i++) { GameObject backgroundFrame = (GameObject)Instantiate(BackGroundManager.Instance.backGroundFrame[i], transform); GameObject background = backgroundFrame.transform.GetChild(0).gameObject; backgroundFrame.tag = "BackGround"; BackGround backgroundData = background.GetComponent <BackGround>(); GameObject lockImage = background.transform.GetChild(0).gameObject; GameObject unlockImage = background.transform.GetChild(1).gameObject; if (i == 0) { backgroundData.Unlock(true); } if (i == BackGroundManager.Instance.CurrentBackGroundIndex) { CurrentSelectBackgr = background; background.GetComponent <OnClickBackGround>().ChangeOutLine(); } if (backgroundData.isFree || backgroundData.IsUnlocked) { lockImage.SetActive(false); unlockImage.SetActive(false); } else { if (CoinManager.Instance.Coins >= backgroundData.price) { lockImage.SetActive(false); unlockImage.SetActive(true); } else { lockImage.SetActive(true); unlockImage.SetActive(false); } } backgroundData.backGroundSequenceNumber = i; } }