IEnumerator MoveTo(Vector3 pos, Vector3 scale, float duration, bool isMainPanel) { desiredPos = pos; desiredScale = scale; float startTime = Time.time; while (Time.time < startTime + duration) { rectTransform.localPosition = Vector3.Lerp(rectTransform.localPosition, pos, (Time.time - startTime)); rectTransform.localScale = Vector3.Lerp(rectTransform.localScale, scale, (Time.time - startTime)); yield return(null); this.isMainPanel = isMainPanel; } rectTransform.localPosition = pos; rectTransform.localScale = scale; if (isMainPanel) { hubShop.mainPanel = this; BlackOut(!HubShop.GetWeaponInfo(weaponName).isUnlocked); } hubShop.isMovingPanels = false; }
public void Show(string weaponName) { curWeaponName = weaponName; gameObject.SetActive(true); if (HubShop.GetWeaponInfo(weaponName).isUnlocked) { if (HubShop.GetWeaponInfo(weaponName).isUpgraded) { button.interactable = false; } else { button.interactable = true; } this.weaponName.SetText(weaponName); weaponDescription.SetText(HubShop.GetWeaponInfo(weaponName).description); } else { this.weaponName.SetText("Locked"); weaponDescription.SetText("That silhouette looks cool. Too bad you haven't unlocked that weapon yet. Go and find it then come back."); button.interactable = false; } }
private void Awake() { rectTransform = GetComponent <RectTransform>(); hubShop = GetComponentInParent <HubShop>(); rawImage = GetComponentInChildren <RawImage>(); BlackOut(!HubShop.GetWeaponInfo(weaponName).isUnlocked); }
public void PurchaseUpgrade() { if (!HubShop.GetWeaponInfo(curWeaponName).isUpgraded) { switch (curWeaponName) { case "Sword": SwordButtonClick(); break; case "Bow": BowButtonClick(); break; case "Hammer": HammerButtonClick(); break; case "Spear": SpearButtonClick(); break; case "Crossbow": CrossbowButtonClick(); break; case "Magic": MagicButtonClick(); break; } } }
//string[] descriptions = //{ // //Sword Description // "The old faithful of many an adventurer. It slices and dices and not much else. But what if it was on fire?", // //Bow Description // "The problem with ranged weapons is it takes time to load. This upgrade keeps your enemies frosty so you can take your time.", // //Hammer Description // "Keep it simple taken to a stupid degree. Why use a hammer when a rock on a stick deals more damage?", // //Spear Description // "If only your spear could stab more than one pot. This upgrade is the closest we could get. Any bystanders to your rampage will be in for a nasty shock.", // //Crossbow Description // "We started from the ground up with this one. We call it a magic missile. Still does the same thing though, just Bigger.", // //Magic Description // "Behold. Magic Magic. It's like Magic but more magical. Also more damage and just all around better.", //}; private void Start() { hubShop = GetComponentInParent <HubShop>(); }