コード例 #1
0
    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;
    }
コード例 #2
0
    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;
        }
    }
コード例 #3
0
    private void Awake()
    {
        rectTransform = GetComponent <RectTransform>();
        hubShop       = GetComponentInParent <HubShop>();
        rawImage      = GetComponentInChildren <RawImage>();

        BlackOut(!HubShop.GetWeaponInfo(weaponName).isUnlocked);
    }
コード例 #4
0
    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;
            }
        }
    }