public void     Load()
    {
        gameManager.isLoading = false;
        currentDeck           = saveDataManager.saveData.currentDeckSave;
        currentDiscard        = saveDataManager.saveData.currentDiscardSave;
        currentBanished       = saveDataManager.saveData.currentBanishedSave;
        currentEffects        = saveDataManager.saveData.currentEffectsSave;
        currentApUsed         = saveDataManager.saveData.currentApUsedSave;
        currentUtilityAP      = saveDataManager.saveData.currentUtilityAPSave;
        currentApMax          = saveDataManager.saveData.currentApMaxSave;
        currentStage          = 1;

        // Draw hand
        for (int i = 0; i < saveDataManager.saveData.currentHandObjectsSave.Count; i++)
        {
            Debug.Log(saveDataManager.saveData.currentHandObjectsSave[i]);
            GameObject newCard       = (GameObject)Instantiate(card, new Vector3(2.50f, -3.1f, 3), Quaternion.Euler(0f, 180f, 90f));
            Sc_Card    newCardScript = newCard.GetComponent <Sc_Card>();
            newCardScript.cardID = saveDataManager.saveData.currentHandObjectsSave[i];
        }
        // Add saved armor cards into play
        for (int i = 0; i < saveDataManager.saveData.currentEquipmentArmorSave.Count; i++)
        {
            Debug.Log(saveDataManager.saveData.currentEquipmentArmorSave[i]);
            int idArmor = saveDataManager.saveData.currentEquipmentArmorSave[i];
            Debug.Log(idArmor);
            if (idArmor < 2000)
            {
                SO_CardArmor card = cardDataBase.FindArmorCardByID(idArmor);
                Defence(idArmor, card.armorBonus, card.spickedBonus);
                PrintLog("you just played " + card.name, "green");
            }
        }
        // Add saved melee cards into play
        for (int i = 0; i < saveDataManager.saveData.currentEquipmentMeleeSave.Count; i++)
        {
            Debug.Log(saveDataManager.saveData.currentEquipmentMeleeSave[i]);
            int idMelee = saveDataManager.saveData.currentEquipmentMeleeSave[i];
            Debug.Log(idMelee);
            if (idMelee < 1000)                   // If the card is a melee card
            {
                SO_CardMelee card = cardDataBase.FindMeleeCardByID(idMelee);
                Melee(idMelee, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage);
                PrintLog("you just played " + card.name, "green");
            }
        }
        // Draw hand
        for (int i = 0; i < gameManager.fullDeck.Count; i++)
        {
            currentDeck.Add(gameManager.fullDeck[i]);
        }
    }
Beispiel #2
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
    }
Beispiel #3
0
    public void CharmingGaze()
    {
        PlayingCard(5, charmingGazeDescription, charmingGazeName);
        battleManager.PrintLog("Placeholder used CharmingGaze", "red");
        if (battleManager.currentDeck.Count <= 0)
        {
            if (battleManager.currentDiscard.Count <= 0)
            {
                return;
            }
            else
            {
                for (int i = 0; i < battleManager.currentDiscard.Count; i++)
                {
                    battleManager.currentDeck.Add(battleManager.currentDiscard[i]);
                }
                battleManager.ShuffleDeck();
                battleManager.currentDiscard.Clear();
            }
        }
        int             id           = battleManager.currentDeck[0];
        Sc_CardDataBase cardDataBase = GameObject.FindObjectOfType <Sc_CardDataBase>();

        if (id < 1000)          // If the card is a melee card
        {
            SO_CardMelee card = cardDataBase.FindMeleeCardByID(id);
            battleManager.PrintLog("Melee with the name " + card.name, "black");
            damage   = card.normalDamage;
            poison   = card.poisonDamage;
            blunt    = card.bluntDamage;
            piercing = card.piercingDamage;
            battleManager.DamageCalc(target: 0, damage: damage, poison: poison, blunt: blunt, piercing: piercing);
        }
        else if (id < 2000)
        {
            SO_CardArmor card = cardDataBase.FindArmorCardByID(id);
            battleManager.PrintLog("Armor with the name " + card.name, "black");
            defence += card.armorBonus;
            UpdateText();
        }
        else if (id < 3000)
        {
            battleManager.PrintLog("A Utility", "black");
        }
        else if (id < 4000)
        {
        }
    }
Beispiel #4
0
    public void SetDamage()
    {
        hasPrimaryAttribute = true;
        SO_CardMelee card = cardDataBase.FindMeleeCardByID(id);

        backgroundSR.sprite              = card.image;
        primaryAttributeTitle.text       = "NORMAL DAMAGE";
        primaryAttributeDescription.text = "Normal damage deals it's damage first to defece and then HP";
        // Check if the weapon deals poison damage
        if (card.poisonDamage > 0)
        {
            firstSecondaryAttributeTitle.text       = "POISON";
            firstSecondaryAttributeDescription.text = "Poison damage, is only dealt, if the target has no armor before the attack";
            hasFirstSecondaryAttribute = true;
        }
        // Check if the weapon deals Blunt damage
        if (card.bluntDamage > 0)
        {
            if (hasFirstSecondaryAttribute)
            {
                secondSecondaryAttributeTitle.text       = "BLUNT";
                secondSecondaryAttributeDescription.text = "Blunt damage is only able to damage defence, but it is dealt before the normal damage is";
                hasSecondSecondaryAttribute = true;
            }
            firstSecondaryAttributeTitle.text       = "BLUNT";
            firstSecondaryAttributeDescription.text = "Blunt damage is only able to damage defence, but it is dealt before the normal damage is";
            hasFirstSecondaryAttribute = true;
        }
        // Check if the weapon deals piercing damage
        if (card.piercingDamage > 0)
        {
            if (hasFirstSecondaryAttribute)
            {
                secondSecondaryAttributeTitle.text       = "PIERCING";
                secondSecondaryAttributeDescription.text = "Pierdcing Damage ignors Defence, deal dirat HP Damage";
                hasSecondSecondaryAttribute = true;
            }
            firstSecondaryAttributeTitle.text       = "PIERCING";
            firstSecondaryAttributeDescription.text = "Pierdcing Damage ignors Defence, deal dirat HP Damage";
            hasFirstSecondaryAttribute = true;
        }
    }
    // 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;
                }
            }
        }
    }
Beispiel #6
0
    public void SetMeleeText()
    {
        SO_CardMelee card = cardDataBase.FindMeleeCardByID(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 = meleeBanner;
        nameTextR.text  = card.name;
        // Set the left Icon
        SpriteRenderer leftIconSR = leftIcon.GetComponent <SpriteRenderer>();

        leftIconSR.sprite = attackIcon;
        GameObject leftIconText  = leftIcon.gameObject.transform.GetChild(0).gameObject;
        TextMesh   leftIconTextR = leftIconText.GetComponent <TextMesh>();

        leftIconTextR.text = card.normalDamage + "";
        // 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
        bool isset = false;

        if (card.poisonDamage > 0)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = leftBonusIconOne.GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = greenBanner;
            GameObject leftBonusIconOneText  = leftBonusIconOne.gameObject.transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.poisonDamage + "";
        }
        else if (card.bluntDamage > 0)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = leftBonusIconOne.GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = grayBanner;
            GameObject leftBonusIconOneText  = leftBonusIconOne.gameObject.transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.bluntDamage + "";
        }
        else
        {
            Destroy(leftBonusIconOne);
        }
        // Set the left bonus two icon
        if (card.bluntDamage > 0 && isset == false)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = leftBonusIconOne.GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = grayBanner;
            GameObject leftBonusIconOneText  = leftBonusIconOne.gameObject.transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.bluntDamage + "";
        }
        else
        {
            Destroy(leftBonusIconTwo);
        }
    }
    // Use this for initialization
    void Start()
    {
        cardDataBase  = GameObject.FindObjectOfType <Sc_CardDataBase>();
        battleManager = GameObject.FindObjectOfType <Sc_BattleManager>();
        SpriteRenderer render = this.gameObject.GetComponent <SpriteRenderer>();

        DiscardPile      = GameObject.Find("DiscardPile");
        endPointDiscardX = DiscardPile.transform.position.x;
        endPointDiscardY = DiscardPile.transform.position.y;


        if (id < 1000)
        {
            card = cardDataBase.FindMeleeCardByID(id);
        }
        render.sprite = card.image;
        battleManager.currentEquipmentMelee.Add(this.gameObject);                            // Add it to the array which holds all card objects
        placementInEquipent = battleManager.currentEquipmentMelee.Count;                     // Saves is place in the array
        Vector3 newPosition = new Vector3(-2f - 0.8f * (placementInEquipent - 1), -1.5f, 0); // Just places it the right place

        this.transform.position = newPosition;

        // Set the left Icon
        GameObject leftIconText  = this.gameObject.transform.GetChild(0).transform.GetChild(0).transform.GetChild(0).gameObject;
        TextMesh   leftIconTextR = leftIconText.GetComponent <TextMesh>();

        leftIconTextR.text = card.normalDamage + "";
        // Set the left bonus one icon
        bool isset = false;

        if (card.poisonDamage > 0)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = this.gameObject.transform.transform.GetChild(0).GetChild(1).gameObject.GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = greenBanner;
            GameObject leftBonusIconOneText  = this.gameObject.transform.transform.GetChild(0).GetChild(1).transform.GetChild(0).gameObject.transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.poisonDamage + "";
        }
        else if (card.bluntDamage > 0)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = this.gameObject.transform.GetChild(0).transform.GetChild(1).GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = grayBanner;
            GameObject leftBonusIconOneText  = this.gameObject.transform.GetChild(0).transform.GetChild(1).transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.bluntDamage + "";
        }
        else
        {
            Destroy(this.gameObject.transform.GetChild(0).transform.GetChild(1).gameObject);
        }
        // Set the left bonus two icon
        if (card.bluntDamage > 0 && isset == false)
        {
            isset = true;
            SpriteRenderer leftBonusIconOneR = this.gameObject.transform.GetChild(0).transform.GetChild(1).GetComponent <SpriteRenderer>();
            leftBonusIconOneR.sprite = grayBanner;
            GameObject leftBonusIconOneText  = this.gameObject.transform.GetChild(0).transform.GetChild(1).transform.GetChild(0).gameObject.transform.GetChild(0).gameObject;
            TextMesh   leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>();
            leftBonusIconOneTextR.text = card.bluntDamage + "";
        }
        else
        {
            Destroy(this.gameObject.transform.transform.GetChild(0).GetChild(2).gameObject);
        }
    }