예제 #1
0
    public void UpdateValuesFromCardAsset()
    {
        if (myCard != null)
        {
            if (myCard.cardType == CardType.Creature)
            {
                myCreatureCard = myCard as SO_Creature;
                buildingCardFront.SetActive(false);
                creatureCardFront.SetActive(true);
                spellCardFront.SetActive(false);

                c_cardNameTextObj.text        = myCard.cardName;
                c_cardTitleTintImageObj.color = myCard.cardTint;
                c_cardCostTextObj.text        = myCard.cost.ToString();
                c_cardImageObj.sprite         = myCard.cardImage;
                c_cardDescTextObj.text        = myCard.cardText;
                c_cardDescTintImageObj.color  = myCard.cardTint;
                c_cardFlavorTextObj.text      = myCard.cardFlavorText;

                c_cardAttackRangeTextObj.text = myCreatureCard.attackRange.ToString();
                c_cardMovementTextObj.text    = myCreatureCard.movement.ToString();
                c_cardDamageTextObj.text      = myCreatureCard.damage.ToString();
                c_cardHealthTextObj.text      = myCreatureCard.health.ToString();
            }

            if (myCard.cardType == CardType.Building)
            {
                myBuildingCard = myCard as SO_Building;
                buildingCardFront.SetActive(true);
                creatureCardFront.SetActive(false);
                spellCardFront.SetActive(false);


                b_cardNameTextObj.text        = myCard.cardName;
                b_cardTitleTintImageObj.color = myCard.cardTint;
                b_cardCostTextObj.text        = myCard.cost.ToString();
                b_cardImageObj.sprite         = myCard.cardImage;
                b_cardDescTextObj.text        = myCard.cardText;
                b_cardDescTintImageObj.color  = myCard.cardTint;
                b_cardFlavorTextObj.text      = myCard.cardFlavorText;
            }

            if (myCard.cardType == CardType.Spell)
            {
                mySpellCard = myCard as SO_Spell;
                buildingCardFront.SetActive(false);
                creatureCardFront.SetActive(false);
                spellCardFront.SetActive(true);

                s_cardNameTextObj.text        = myCard.cardName;
                s_cardTitleTintImageObj.color = myCard.cardTint;
                s_cardCostTextObj.text        = myCard.cost.ToString();
                s_cardImageObj.sprite         = myCard.cardImage;
                s_cardDescTextObj.text        = myCard.cardText;
                s_cardDescTintImageObj.color  = myCard.cardTint;
                s_cardFlavorTextObj.text      = myCard.cardFlavorText;
            }
        }
    }
예제 #2
0
    protected virtual void TokenSetUp()
    {
        haveSetUp     = true;
        myTokensImage = myCard.cardImage;

        if (myTokenImageObj != null)
        {
            myTokenImageObj.sprite = myTokensImage;
        }

        if (myCard.cardType == CardType.Creature)
        {
            myCreatureCard = myCard as SO_Creature;

            maxHealth     = myCreatureCard.health;
            currentHealth = maxHealth;

            maxMovement = myCreatureCard.movement;
            if (myCreatureCard.hasHaste)
            {
                remainingMovement = maxMovement;
            }
            else
            {
                remainingMovement = 0;
            }

            attackRange  = myCreatureCard.attackRange;
            attackDamage = myCreatureCard.damage;

            GetComponent <MeshRenderer>().material = TokenMaterial();
        }

        if (myCard.cardType == CardType.Building)
        {
            myBuildingCard = myCard as SO_Building;

            maxHealth     = myBuildingCard.health;
            currentHealth = maxHealth;

            attackRange  = myBuildingCard.attackRange;
            attackDamage = myBuildingCard.damage;

            if (myBuildingCard.impactsGoldPerTurn)
            {
                CurrencyManager.instance.IncreaseGoldPerTurn(myBuildingCard.goldPerTurnIncrease);
            }
            if (myBuildingCard.canSpawnToken)
            {
                countToAction = myBuildingCard.tokenSpawnEveryXTturns;
            }
            if (myBuildingCard.canChangeNodeType)
            {
                List <Node> changeNodes = new List <Node>();
                Node        myNode      = ReturnNodeIAmOn();

                myBattleGrid = FindObjectOfType <ArenaGrid>();
                changeNodes  = myBattleGrid.GetNeighboursInRange(myNode, 1);

                foreach (Node node in changeNodes)
                {
                    node.tileType = myBuildingCard.nodeTypeToAdd;
                    node.tileTeam = myTeam;
                    node.UpdateMaterial(node.tileTeam, node.tileType, node.walkable);
                }
            }

            GetComponent <MeshRenderer>().material = TokenMaterial();
        }

        if (myCard.cardType == CardType.Spell)
        {
            mySpellCard = myCard as SO_Spell;
        }

        RecalcBuffs();
    }