コード例 #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;
            }
        }
    }
コード例 #5
0
    //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>();
    }