示例#1
0
 public void PlayCard(int id)      // Play a card
 {
     currentDiscard.Add(id);
     // if( discard > 0 ) make discard pile visable
     // make discard pile sprite be last discarded card
     //currentHand.RemoveAt(randomCard);
     if (id < 1000)  // If the card is a melee card
     {
         SO_CardMelee card = cardDataBase.FindMeleeCardByID(id);
         Melee(id, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage);
         PrintLog("you just played " + card.name, "green");
     }
     else if (id < 2000)
     {
         SO_CardArmor card = cardDataBase.FindArmorCardByID(id);
         Defence(id, card.armorBonus, card.spickedBonus);
         PrintLog("you just played " + card.name, "green");
     }
     else if (id < 3000)
     {
         CardUtility card = cardDataBase.FindUtilityCardByID(id);
         PrintLog("you just played " + card.name, "green");
         Utility(id);
     }
     else if (id < 4000)
     {
         CardCurse card = cardDataBase.FindCurseCardByID(id);
         PrintLog("You got cursed by" + card.name, "red");
         card.PlayedFunction();
     }
 }
示例#2
0
    public void SetUtilityText()
    {
        CardUtility card = cardDataBase.FindUtilityCardByID(cardID);
        // set description text
        GameObject descriptionText  = description.gameObject.transform.GetChild(0).gameObject;
        TextMesh   descriptionTextR = descriptionText.GetComponent <TextMesh>();

        descriptionTextR.text = card.decription;
        // set banner and name text
        SpriteRenderer bannerSR  = banner.GetComponent <SpriteRenderer>();
        GameObject     nameText  = banner.gameObject.transform.GetChild(0).gameObject;
        TextMesh       nameTextR = nameText.GetComponent <TextMesh>();

        bannerSR.sprite = utilityBanner;
        nameTextR.text  = card.name;
        // Set the left Icon
        Destroy(leftIcon);
        // Set the Right Icon
        SpriteRenderer rightIconSR = rightIcon.GetComponent <SpriteRenderer>();

        rightIconSR.sprite = costIcon;
        GameObject rightIconText  = rightIcon.gameObject.transform.GetChild(0).gameObject;
        TextMesh   rightIconTextR = rightIconText.GetComponent <TextMesh>();

        rightIconTextR.text = card.apCost + "";
        // Set the left bonus one icon
        Destroy(leftBonusIconOne);
        // Set the left bonus two icon
        Destroy(leftBonusIconTwo);
    }
示例#3
0
    void Start()
    {
        cardDataBase     = GameObject.FindObjectOfType <Sc_CardDataBase>();
        battleManager    = GameObject.FindObjectOfType <Sc_BattleManager>();
        endPointDiscardX = GameObject.Find("DiscardPile").transform.position.x;
        endPointDiscardY = GameObject.Find("DiscardPile").transform.position.y;


        endPointY = -4.4f;
        Sc_BattleManager.currentHandObjects.Add(this.gameObject);         // Add it to the array which holds all card objects
        placementInHand = Sc_BattleManager.currentHandObjects.Count;      // Saves is place in the array
        // Vector3 newPosition = new Vector3 (1.1f * placementInHand, 2.2f, 0); // Just places it the right place
        // this.transform.position = newPosition;


        // Set the background of the card
        background = this.gameObject.transform.GetChild(0).gameObject;
        SpriteRenderer backgroundSR = background.GetComponent <SpriteRenderer>();

        description      = this.gameObject.transform.GetChild(1).gameObject;
        banner           = this.gameObject.transform.GetChild(2).gameObject;
        leftIcon         = this.gameObject.transform.GetChild(3).gameObject;
        rightIcon        = this.gameObject.transform.GetChild(4).gameObject;
        leftBonusIconOne = this.gameObject.transform.GetChild(5).gameObject;
        leftBonusIconTwo = this.gameObject.transform.GetChild(6).gameObject;

        if (cardID < 1000)
        {
            SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardID);
            apCost = card.apCost;
            backgroundSR.sprite = card.image;
            SetMeleeText();
        }
        else if (cardID < 2000)
        {
            SO_CardArmor card = cardDataBase.FindArmorCardByID(cardID);
            apCost = card.apCost;
            backgroundSR.sprite = card.image;
            SetArmorText();
        }
        else if (cardID < 3000)
        {
            CardUtility card = cardDataBase.FindUtilityCardByID(cardID);
            apCost = card.apCost;
            backgroundSR.sprite = card.image;
            SetUtilityText();
        }
        else if (cardID < 4000)
        {
            CardCurse card = cardDataBase.FindCurseCardByID(cardID);
            apCost = card.apCost;
            backgroundSR.sprite = card.image;
        }


        // Get other components
    }
示例#4
0
    public void SetUtility()
    {
        hasSpecial = true;
        CardUtility card = cardDataBase.FindUtilityCardByID(id);

        backgroundSR.sprite = card.image;
        print(card.GetType().Name);
        if (card.GetType().Name == "SO_UtilityAp")
        {
            specialTitle.text       = "AP Increase";
            specialDescription.text = "This type of utility card, increases the amount of AP you have this turn";
        }
        else if (card.GetType().Name == "SO_UtilityDamage")
        {
            specialTitle.text       = "Damage";
            specialDescription.text = "This type of utility card, deals damage to the monster when played";
        }
        else if (card.GetType().Name == "SO_UtilityDeBuff")
        {
            specialTitle.text       = "Debuff";
            specialDescription.text = "This type of utility card, decreases the abilities of the monster";
        }
        else if (card.GetType().Name == "SO_UtilityDoubleAttack")
        {
            specialTitle.text       = "Double Attack";
            specialDescription.text = "This type of utility card, makes you attack twice this turn";
        }
        else if (card.GetType().Name == "SO_UtilityDraw")
        {
            specialTitle.text       = "Draw";
            specialDescription.text = "This type of utility card, draws extra cards, but you may have to dicard some";
        }
        else if (card.GetType().Name == "SO_UtilityHealth")
        {
            specialTitle.text       = "Health";
            specialDescription.text = "This type of utility card, gives you back some of your banished card";
        }
        else if (card.GetType().Name == "SO_UtilityPermaBuff")
        {
            specialTitle.text       = "Perment Buff";
            specialDescription.text = "This type of utility card, gives you buff which last until the of the battle";
        }
        else if (card.GetType().Name == "SO_UtilityRage")
        {
            specialTitle.text       = "Rage";
            specialDescription.text = "For each weapon you have, add your rage bonus to your attacks";
        }
        else if (card.GetType().Name == "SO_UtilityRecycle")
        {
            specialTitle.text       = "Recycle";
            specialDescription.text = "Allways you to take cards from your discard pile, back op to your hand";
        }
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (battleManager.currentDiscard.Count != 0)
        {
            cardDiscardID = battleManager.currentDiscard[battleManager.currentDiscard.Count - 1];
        }
        if (battleManager.currentBanished.Count != 0)
        {
            cardBanishID = battleManager.currentBanished[battleManager.currentBanished.Count - 1];
        }

        if (DeckType == 1)
        {
            if (battleManager.currentDiscard.Capacity == 0)
            {
                //is card back display
                // Set the background of the card
            }

            if (battleManager.currentDiscard.Capacity > 0)
            {
                //is last card display
                if (cardDiscardID < 1000)
                {
                    SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardDiscardID);

                    SpriteRenderer2.sprite = card.image;
                }
                else if (cardDiscardID < 2000)
                {
                    SO_CardArmor card = cardDataBase.FindArmorCardByID(cardDiscardID);

                    SpriteRenderer2.sprite = card.image;
                }
                else if (cardDiscardID < 3000)
                {
                    CardUtility card = cardDataBase.FindUtilityCardByID(cardDiscardID);

                    SpriteRenderer2.sprite = card.image;
                }
            }
        }
        else if (DeckType == 2)
        {
            if (battleManager.currentBanished.Capacity == 0)
            {
                //is card back display
            }
            if (battleManager.currentBanished.Capacity > 0)
            {
                //is last card display
                if (cardBanishID < 1000)
                {
                    SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardBanishID);

                    SpriteRenderer3.sprite = card.image;
                }
                else if (cardBanishID < 2000)
                {
                    SO_CardArmor card = cardDataBase.FindArmorCardByID(cardBanishID);

                    SpriteRenderer3.sprite = card.image;
                }
                else if (cardBanishID < 3000)
                {
                    CardUtility card = cardDataBase.FindUtilityCardByID(cardBanishID);

                    SpriteRenderer3.sprite = card.image;
                }
            }
        }
    }