Esempio n. 1
0
    public void OnDrawCard() //called by button
    {
        isStarted = true;
        if (battlescript.state == BattleState.PLAYERTURN) {

            //look for sodier here for player
            //apply affects to player
            if (deck[deckIterator].GetComponent<CardUnit>().CardName == "Soldier")
            {
                battlescript.playerUnit.currentAtkMod += deck[deckIterator].GetComponent<CardUnit>().PlayerAtkModVal;
                battlescript.playerUnit.currentDefMod += deck[deckIterator].GetComponent<CardUnit>().PlayerDefModVal;
            }

            //if unit has less than 20 health draw from tier 2 deck
            if (battlescript.playerUnit.currentHP <= 20)
            {
                if (isTruePlayerCardHolder1 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = PlayerCardHolder1.transform;
                    tier2Deck[tier2deckIterator].transform.position = PlayerCardHolder1.transform.position;
                    tier2deckIterator++;
                    isTruePlayerCardHolder1 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder2 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = PlayerCardHolder2.transform;
                    tier2Deck[tier2deckIterator].transform.position = PlayerCardHolder2.transform.position;
                    tier2deckIterator++;
                    isTruePlayerCardHolder2 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder3 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = PlayerCardHolder3.transform;
                    tier2Deck[tier2deckIterator].transform.position = PlayerCardHolder3.transform.position;
                    tier2deckIterator++;
                    isTruePlayerCardHolder3 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder4 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = PlayerCardHolder4.transform;
                    tier2Deck[tier2deckIterator].transform.position = PlayerCardHolder4.transform.position;
                    tier2deckIterator++;
                    isTruePlayerCardHolder4 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder5 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = PlayerCardHolder5.transform;
                    tier2Deck[tier2deckIterator].transform.position = PlayerCardHolder5.transform.position;
                    tier2deckIterator++;
                    isTruePlayerCardHolder5 = true;
                    battlescript.OnDrawButton();
                    return;
                }
            }
            else
            {
                //check player doesnt have Full Hand
                if (isTruePlayerCardHolder1 == false)
                {
                    deck[deckIterator].transform.parent = PlayerCardHolder1.transform;
                    deck[deckIterator].transform.position = PlayerCardHolder1.transform.position;
                    deckIterator++;
                    isTruePlayerCardHolder1 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder2 == false)
                {
                    deck[deckIterator].transform.parent = PlayerCardHolder2.transform;
                    deck[deckIterator].transform.position = PlayerCardHolder2.transform.position;
                    deckIterator++;
                    isTruePlayerCardHolder2 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder3 == false)
                {
                    deck[deckIterator].transform.parent = PlayerCardHolder3.transform;
                    deck[deckIterator].transform.position = PlayerCardHolder3.transform.position;
                    deckIterator++;
                    isTruePlayerCardHolder3 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder4 == false)
                {
                    deck[deckIterator].transform.parent = PlayerCardHolder4.transform;
                    deck[deckIterator].transform.position = PlayerCardHolder4.transform.position;
                    deckIterator++;
                    isTruePlayerCardHolder4 = true;
                    battlescript.OnDrawButton();
                    return;
                }
                else if (isTruePlayerCardHolder5 == false)
                {
                    deck[deckIterator].transform.parent = PlayerCardHolder5.transform;
                    deck[deckIterator].transform.position = PlayerCardHolder5.transform.position;
                    deckIterator++;
                    isTruePlayerCardHolder5 = true;
                    battlescript.OnDrawButton();
                    return;
                }
            }
        }


        //enemy draw
        if (battlescript.state == BattleState.ENEMYTURN)
        {
            //look for sodier here for player
            //apply affects to player
            if (deck[deckIterator].GetComponent<CardUnit>().CardName == "Soldier")
            {
                battlescript.enemyUnit.currentAtkMod += deck[deckIterator].GetComponent<CardUnit>().PlayerAtkModVal;
                battlescript.enemyUnit.currentDefMod += deck[deckIterator].GetComponent<CardUnit>().PlayerDefModVal;
            }

            if (battlescript.enemyUnit.currentHP <= 20)
            {
                if (isTrueEnemyCardHolder1 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = EnemyCardHolder1.transform;
                    tier2Deck[tier2deckIterator].transform.position = EnemyCardHolder1.transform.position;
                    EnemyCardBack1.SetActive(true);
                    tier2Deck[tier2deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder1.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    tier2deckIterator++;
                    isTrueEnemyCardHolder1 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder2 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = EnemyCardHolder2.transform;
                    tier2Deck[tier2deckIterator].transform.position = EnemyCardHolder2.transform.position;
                    EnemyCardBack2.SetActive(true);
                    tier2Deck[tier2deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder2.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    tier2deckIterator++;
                    isTrueEnemyCardHolder2 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder3 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = EnemyCardHolder3.transform;
                    tier2Deck[tier2deckIterator].transform.position = EnemyCardHolder3.transform.position;
                    EnemyCardBack2.SetActive(true);
                    tier2Deck[tier2deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder3.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    tier2deckIterator++;
                    isTrueEnemyCardHolder3 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder4 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = EnemyCardHolder4.transform;
                    tier2Deck[tier2deckIterator].transform.position = EnemyCardHolder4.transform.position;
                    EnemyCardBack4.SetActive(true);
                    tier2Deck[tier2deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder4.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    tier2deckIterator++;
                    isTrueEnemyCardHolder4 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder5 == false)
                {
                    tier2Deck[tier2deckIterator].transform.parent = EnemyCardHolder5.transform;
                    tier2Deck[tier2deckIterator].transform.position = EnemyCardHolder5.transform.position;
                    EnemyCardBack5.SetActive(true);
                    tier2Deck[tier2deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder5.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    tier2deckIterator++;
                    isTrueEnemyCardHolder5 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
            }
            else
            {
                //check player doesnt have full hand
                if (isTrueEnemyCardHolder1 == false)
                {
                    deck[deckIterator].transform.parent = EnemyCardHolder1.transform;
                    deck[deckIterator].transform.position = EnemyCardHolder1.transform.position;
                    EnemyCardBack1.SetActive(true);
                    deck[deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder1.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    deckIterator++;
                    isTrueEnemyCardHolder1 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder2 == false)
                {
                    deck[deckIterator].transform.parent = EnemyCardHolder2.transform;
                    deck[deckIterator].transform.position = EnemyCardHolder2.transform.position;
                    EnemyCardBack2.SetActive(true);
                    deck[deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder2.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    deckIterator++;
                    isTrueEnemyCardHolder2 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder3 == false)
                {
                    deck[deckIterator].transform.parent = EnemyCardHolder3.transform;
                    deck[deckIterator].transform.position = EnemyCardHolder3.transform.position;
                    EnemyCardBack3.SetActive(true);
                    deck[deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder3.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    deckIterator++;
                    isTrueEnemyCardHolder3 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder4 == false)
                {
                    deck[deckIterator].transform.parent = EnemyCardHolder4.transform;
                    deck[deckIterator].transform.position = EnemyCardHolder4.transform.position;
                    EnemyCardBack4.SetActive(true);
                    deck[deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder4.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    deckIterator++;
                    isTrueEnemyCardHolder4 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
                else if (isTrueEnemyCardHolder5 == false)
                {
                    deck[deckIterator].transform.parent = EnemyCardHolder5.transform;
                    deck[deckIterator].transform.position = EnemyCardHolder5.transform.position;
                    EnemyCardBack5.SetActive(true);
                    deck[deckIterator].transform.GetChild(0).GetComponentInChildren<Button>().interactable = false;
                    EnemyCardHolder5.transform.GetChild(0).GetComponent<Collider2D>().enabled = false;
                    deckIterator++;
                    isTrueEnemyCardHolder5 = true;
                    battlescript.state = BattleState.PLAYERTURN;
                    battlescript.PlayerTurn();
                    return;
                }
            }
        }
    }
Esempio n. 2
0
    public void OnDrawCard() //called by button
    {
        isStarted = true;
        if (battlescript.state == BattleState.PLAYERTURN)
        {
            //check player doesnt have Full Hand
            if (isTruePlayerCardHolder1 == false)
            {
                deck[deckIterator].transform.parent   = PlayerCardHolder1.transform;
                deck[deckIterator].transform.position = PlayerCardHolder1.transform.position;
                deckIterator++;
                isTruePlayerCardHolder1 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder2 == false)
            {
                deck[deckIterator].transform.parent   = PlayerCardHolder2.transform;
                deck[deckIterator].transform.position = PlayerCardHolder2.transform.position;
                deckIterator++;
                isTruePlayerCardHolder2 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder3 == false)
            {
                deck[deckIterator].transform.parent   = PlayerCardHolder3.transform;
                deck[deckIterator].transform.position = PlayerCardHolder3.transform.position;
                deckIterator++;
                isTruePlayerCardHolder3 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder4 == false)
            {
                deck[deckIterator].transform.parent   = PlayerCardHolder4.transform;
                deck[deckIterator].transform.position = PlayerCardHolder4.transform.position;
                deckIterator++;
                isTruePlayerCardHolder4 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder5 == false)
            {
                deck[deckIterator].transform.parent   = PlayerCardHolder5.transform;
                deck[deckIterator].transform.position = PlayerCardHolder5.transform.position;
                deckIterator++;
                isTruePlayerCardHolder5 = true;
                battlescript.OnDrawButton();
                return;
            }
        }

        //enemy draw
        if (battlescript.state == BattleState.ENEMYTURN)
        {
            //check player doesnt have full hand
            if (isTrueEnemyCardHolder1 == false)
            {
                deck[deckIterator].transform.parent   = EnemyCardHolder1.transform;
                deck[deckIterator].transform.position = EnemyCardHolder1.transform.position;
                EnemyCardBack1.SetActive(true);
                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                EnemyCardHolder1.transform.GetChild(0).GetComponent <Collider2D>().enabled = false;
                deckIterator++;
                isTrueEnemyCardHolder1 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder2 == false)
            {
                deck[deckIterator].transform.parent   = EnemyCardHolder2.transform;
                deck[deckIterator].transform.position = EnemyCardHolder2.transform.position;
                EnemyCardBack2.SetActive(true);
                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                EnemyCardHolder2.transform.GetChild(0).GetComponent <Collider2D>().enabled = false;
                deckIterator++;
                isTrueEnemyCardHolder2 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder3 == false)
            {
                deck[deckIterator].transform.parent   = EnemyCardHolder3.transform;
                deck[deckIterator].transform.position = EnemyCardHolder3.transform.position;
                EnemyCardBack3.SetActive(true);
                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                EnemyCardHolder3.transform.GetChild(0).GetComponent <Collider2D>().enabled = false;
                deckIterator++;
                isTrueEnemyCardHolder3 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder4 == false)
            {
                deck[deckIterator].transform.parent   = EnemyCardHolder4.transform;
                deck[deckIterator].transform.position = EnemyCardHolder4.transform.position;
                EnemyCardBack4.SetActive(true);
                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                EnemyCardHolder4.transform.GetChild(0).GetComponent <Collider2D>().enabled = false;
                deckIterator++;
                isTrueEnemyCardHolder4 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder5 == false)
            {
                deck[deckIterator].transform.parent   = EnemyCardHolder5.transform;
                deck[deckIterator].transform.position = EnemyCardHolder5.transform.position;
                EnemyCardBack5.SetActive(true);
                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                EnemyCardHolder5.transform.GetChild(0).GetComponent <Collider2D>().enabled = false;
                deckIterator++;
                isTrueEnemyCardHolder5 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
        }
    }
Esempio n. 3
0
    public void OnDrawCard() //called by button
    {
        if (battlescript.state == BattleState.PLAYERTURN)
        {
            //check player doesnt have 3 cards already
            if (isTruePlayerCardHolder1 == false)
            {
                //deck[deckIterator].transform.position = PlayerCardHolder1.transform.position;
                deck[deckIterator].transform.parent   = PlayerCardHolder1.transform;
                deck[deckIterator].transform.position = PlayerCardHolder1.transform.position;  //new Vector3(0f, 0f, 100f);
                deckIterator++;
                isTruePlayerCardHolder1 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder2 == false)
            {
                //deck[deckIterator].transform.position = PlayerCardHolder2.transform.position;
                deck[deckIterator].transform.parent   = PlayerCardHolder2.transform;
                deck[deckIterator].transform.position = PlayerCardHolder2.transform.position;
                deckIterator++;
                isTruePlayerCardHolder2 = true;
                battlescript.OnDrawButton();
                return;
            }
            else if (isTruePlayerCardHolder3 == false)
            {
                //deck[deckIterator].transform.position = PlayerCardHolder3.transform.position;
                deck[deckIterator].transform.parent   = PlayerCardHolder3.transform;
                deck[deckIterator].transform.position = PlayerCardHolder3.transform.position;
                deckIterator++;
                isTruePlayerCardHolder3 = true;
                battlescript.OnDrawButton();
                return;
            }
        }

        //enemy draw
        if (battlescript.state == BattleState.ENEMYTURN)
        {
            //check player doesnt have 3 cards already
            if (isTrueEnemyCardHolder1 == false)
            {
                //deck[deckIterator].transform.position = EnemyCardHolder1.transform.position;
                deck[deckIterator].transform.parent   = EnemyCardHolder1.transform;
                deck[deckIterator].transform.position = EnemyCardHolder1.transform.position;

                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                deckIterator++;
                isTrueEnemyCardHolder1 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder2 == false)
            {
                //deck[deckIterator].transform.position = EnemyCardHolder2.transform.position;
                deck[deckIterator].transform.parent   = EnemyCardHolder2.transform;
                deck[deckIterator].transform.position = EnemyCardHolder2.transform.position;

                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                deckIterator++;
                isTrueEnemyCardHolder2 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
            else if (isTrueEnemyCardHolder3 == false)
            {
                //deck[deckIterator].transform.position = EnemyCardHolder3.transform.position;
                deck[deckIterator].transform.parent   = EnemyCardHolder3.transform;
                deck[deckIterator].transform.position = EnemyCardHolder3.transform.position;

                deck[deckIterator].transform.GetChild(0).GetComponentInChildren <Button>().interactable = false;
                deckIterator++;
                isTrueEnemyCardHolder3 = true;
                battlescript.state     = BattleState.PLAYERTURN;
                battlescript.PlayerTurn();
                return;
            }
        }
        //Debug.Log("button push cardsystem says high");
    }