Пример #1
0
    void Start()
    {
        goldValue    = 10;
        numberOfBuys = 11;

        actionButton.interactable = false;
        shopButton.interactable   = false;
        backButton.interactable   = false;
        endButton.interactable    = false;

        ColorBlock cb = actionButton.colors;

        turnColor.a         = 1;
        cb.disabledColor    = turnColor;
        actionButton.colors = cb;

        KillExtraCards();
        DealPlayerHand();
        DealEnemyHand();

        shopButton.onClick.AddListener(GoToShop);
        backButton.onClick.AddListener(GoBack);
        buyPhaseButton.onClick.AddListener(BuyPhase);
        endButton.onClick.AddListener(EndTurn);

        StartCoroutine(checkFetches(0.2f));
        StartCoroutine(finishDealing(0.4f));

        cardsInText   = cardsInDeck.GetComponent <Text> ();
        cardsInDpText = cardsInDp.GetComponent <Text> ();

        pbLeft  = powerButtonLeft.GetComponent <Button> ();
        pbRight = powerButtonRight.GetComponent <Button> ();

        hdScript        = playerHeroes.GetComponentInChildren <HeroDrop> ();
        discardDropdown = dropDownObject.GetComponent <Dropdown> ();

        pbLeft.onClick.AddListener(PowerButtonLeft);
        pbRight.onClick.AddListener(PowerButtonRight);

        pbLeft.interactable  = false;
        pbRight.interactable = false;

        leftButton  = 0;
        rightButton = 0;

        discardDropdown.ClearOptions();
        dropDownObject.SetActive(false);
        scavengeButtonObj.SetActive(false);
        scavengeButton.onClick.AddListener(ChooseScavenge);
    }
Пример #2
0
    void AreAllHeroesMaxed()
    {
        int j = 0;

        for (int i = 0; i < 3; i++)
        {
            HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
            if (hdScript.currentLevel == 6)
            {
                j++;
            }
        }

        if (j == 3)
        {
            areAllHeroesMaxed = true;
        }
    }
Пример #3
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        dragOffset  = eventData.position - (Vector2)this.transform.position;
        placeholder = new GameObject();
        placeholder.transform.SetParent(this.transform.parent);
        LayoutElement le = placeholder.AddComponent <LayoutElement>();

        le.preferredWidth  = this.GetComponent <LayoutElement>().preferredWidth;
        le.preferredHeight = this.GetComponent <LayoutElement>().preferredHeight;
        le.flexibleWidth   = 0;
        le.flexibleHeight  = 0;

        placeholder.transform.SetSiblingIndex(this.transform.GetSiblingIndex());

        parentToReturnTo  = this.transform.parent;
        placeholderParent = parentToReturnTo;
        this.transform.SetParent(this.transform.parent.parent);

        GetComponent <CanvasGroup>().blocksRaycasts = false;

        if (this.gameObject.name == "Health Vial" || this.gameObject.name == "HealthPotion")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentHealth < hdScript.totalHealth)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "Mana Vial" || this.gameObject.name == "ManaPotion")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana < hdScript.totalMana)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "Fetch Quest" || this.gameObject.name == "PotOfGreed")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana > 0)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "SpecialPotion")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana < hdScript.totalMana || hdScript.currentHealth < hdScript.totalHealth)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "JarOfGreed" || this.gameObject.name == "StolenPouch")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana > 1)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "Lifesteal" || this.gameObject.name == "Manasteal" || this.gameObject.name == "Thief" || this.gameObject.name == "TargetBlock" || this.gameObject.name == "ValorOfHercules" || this.gameObject.name == "DresdensRobe")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.playZone.childCount < 2)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "InnerPower" || this.gameObject.name == "TransmuteLife")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentHealth > 2)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "WealthIsHealth")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana > 2)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }

        if (this.gameObject.name == "VictoryMedal")
        {
            for (int i = 0; i < playerHeroes.transform.childCount; i++)
            {
                heroTint = playerHeroes.transform.GetChild(i).GetComponentInChildren <Image> ();
                HeroDrop hdScript = playerHeroes.transform.GetChild(i).GetComponent <HeroDrop> ();
                if (hdScript.currentMana > 4)
                {
                    heroTint.color = new Color(0, 1, 0, 0.3f);
                }
            }
        }
    }
Пример #4
0
    IEnumerator SelectHero(float waitTime)
    {
        gcScript.shopButton.interactable = false;
        yield return(new WaitForSeconds(waitTime));

        gcScript.messageText.text = "Please left-click on a hero you wish to level up";
        while (true)
        {
            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                if (Physics.Raycast(ray, out hit))
                {
                    clickedHero = hit.transform.gameObject;
                    HeroDrop hdScript = clickedHero.GetComponent <HeroDrop> ();
                    if (hit.transform.parent == playerHeroes.transform && hdScript.currentLevel < 6)
                    {
                        gcScript.pbLeft.interactable  = true;
                        gcScript.pbRight.interactable = true;
                        gcScript.leftButton           = 0;
                        gcScript.rightButton          = 0;
                        gcScript.ZoomOff(true, whichChild());

                        hdScript.currentLevel++;
                        heroTree  = hit.transform.gameObject.gameObject.transform.GetChild(4).gameObject;
                        heroPower = heroTree.gameObject.transform.GetChild(0).gameObject;
                        heroLevel = heroTree.gameObject.transform.GetChild(1).gameObject;
                        if (hdScript.currentLevel == 2 || hdScript.currentLevel == 4 || hdScript.currentLevel == 6)
                        {
                            gcScript.messageText.text = "Skill Choice for " + hit.transform.gameObject.name + " at level " + hdScript.currentLevel.ToString() + ": Select the power you wish to unlock";
                            while (true)
                            {
                                if (hdScript.currentLevel == 2)
                                {
                                    powerLeft          = heroPower.gameObject.transform.GetChild(0).gameObject;
                                    powerRight         = heroPower.gameObject.transform.GetChild(1).gameObject;
                                    currentLevelObject = heroLevel.gameObject.transform.GetChild(1).gameObject;
                                }

                                if (hdScript.currentLevel == 4)
                                {
                                    powerLeft          = heroPower.gameObject.transform.GetChild(2).gameObject;
                                    powerRight         = heroPower.gameObject.transform.GetChild(3).gameObject;
                                    currentLevelObject = heroLevel.gameObject.transform.GetChild(3).gameObject;
                                }

                                if (hdScript.currentLevel == 6)
                                {
                                    powerLeft          = heroPower.gameObject.transform.GetChild(4).gameObject;
                                    powerRight         = heroPower.gameObject.transform.GetChild(5).gameObject;
                                    currentLevelObject = heroLevel.gameObject.transform.GetChild(5).gameObject;
                                }

                                leftText               = powerLeft.GetComponent <Text> ();
                                rightText              = powerRight.GetComponent <Text> ();
                                currentLevelText       = currentLevelObject.GetComponent <Text> ();
                                leftText.color         = Color.yellow;
                                rightText.color        = Color.yellow;
                                currentLevelText.color = Color.green;
                                hdScript.totalHealth++;
                                hdScript.totalMana++;
                                StartCoroutine(PowerChoice());
                                yield break;
                            }
                        }

                        if (hdScript.currentLevel == 3 || hdScript.currentLevel == 5)
                        {
                            if (hdScript.currentLevel == 3)
                            {
                                currentLevelObject = heroLevel.gameObject.transform.GetChild(2).gameObject;
                                if (hit.transform.gameObject.name == "Thaeton" || hit.transform.gameObject.name == "Sven" || hit.transform.gameObject.name == "Triss")
                                {
                                    hdScript.totalHealth++;
                                    hdScript.totalMana++;
                                }
                            }

                            if (hdScript.currentLevel == 5)
                            {
                                currentLevelObject = heroLevel.gameObject.transform.GetChild(4).gameObject;
                            }

                            if (hit.transform.gameObject.name == "Akasha" || hit.transform.gameObject.name == "Elwyn" || hit.transform.gameObject.name == "Madalyn")
                            {
                                hdScript.totalHealth++;
                            }

                            if (hit.transform.gameObject.name == "Lina" || hit.transform.gameObject.name == "Zane" || hit.transform.gameObject.name == "Isador")
                            {
                                hdScript.totalMana++;
                            }

                            currentLevelText                 = currentLevelObject.GetComponent <Text> ();
                            currentLevelText.color           = Color.green;
                            gcScript.shopButton.interactable = true;
                            gcScript.endButton.interactable  = true;
                            gcScript.pbLeft.interactable     = false;
                            gcScript.pbRight.interactable    = false;
                            gcScript.ZoomOff(false, whichChild());
                            gcScript.messageText.text = hit.transform.gameObject.name + " is now level " + hdScript.currentLevel;
                            gcScript.leftButton       = 0;
                            gcScript.rightButton      = 0;
                            yield break;
                        }
                    }
                    else
                    {
                        gcScript.messageText.text = "Please left-click on one of your heroes to level him/her up";
                    }
                }
                else
                {
                    gcScript.messageText.text = "Please left-click on one of your heroes to level him/her up";
                }
            }
            yield return(null);
        }
    }