Beispiel #1
0
    public void summonMonster()
    {
        monster.transform.SetParent(zone.transform);
        monster.transform.position    = zone.transform.position;
        monster.transform.eulerAngles = zone.transform.eulerAngles;

        monster.GetComponent <ThisMonsterCard>().setSummoned(true);
        monster.GetComponent <ThisMonsterCard>().setZoneSummoned(zone);
        monster.GetComponent <ThisMonsterCard>().getZoneInHand().GetComponent <HandZone>().setCard(null);
        monster.GetComponent <ThisMonsterCard>().setZoneInHand(null);
        zone.GetComponent <FieldMonsterZone>().setMonster(monster);

        MonsterCard monsterCard = monster.GetComponent <ThisMonsterCard>().getMonsterCard();
        Mana        manaCounter = monster.GetComponent <ThisMonsterCard>().getMyPlayer().getManaGameObject().GetComponent <Mana>();
        MonsterHand hand        = monster.GetComponent <ThisMonsterCard>().getMyPlayer().getMonsterHandGameObject().GetComponent <MonsterHand>();

        // Pay the mana cost
        manaCounter.setCurrentMana(manaCounter.getCurrentMana() - monsterCard.getCost());
        // Set the correct number of cards in hand and Arrange them
        hand.setNmbMonstersInHand(hand.getNmbMonstersInHand() - 1);
        hand.arrangeCards();

        FieldMonsters f = monster.GetComponent <ThisMonsterCard>().getMyPlayer().getFieldGameObject().GetComponent <FieldMonsters>();

        f.setMonstersInPlay(f.getMonstersInPlay() + 1);
    }
Beispiel #2
0
    IEnumerator enemyPlayerBot()
    {
        handToggleA2.SetActive(false);
        handToggleM2.SetActive(false);

        yield return(new WaitForSeconds(6 * waitTime));

        Mana manaCounter = thisPlayer.getManaGameObject().GetComponent <Mana>();

        MonsterHand mHand = thisPlayer.getMonsterHandGameObject().GetComponent <MonsterHand>();

        AugmentHand aHand = thisPlayer.getAugmentHandGameObject().GetComponent <AugmentHand>();

        FieldMonsters fMonsters = thisPlayer.getFieldGameObject().GetComponent <FieldMonsters>();

        thisPlayer.getMonsterHandGameObject().SetActive(true);
        thisPlayer.getAugmentHandGameObject().SetActive(false);

        if (fMonsters.getMonstersInPlay() < 5)
        {
            List <GameObject> zones = mHand.getZones();

            for (int i = 0; i < mHand.getNmbMonstersInHand(); i++)
            {
                MonsterCard mCard = zones[i].GetComponent <HandZone>().getCard().GetComponent <ThisMonsterCard>().getMonsterCard();

                if (mCard.getCost() <= manaCounter.getCurrentMana())
                {
                    ThisMonsterCard tmCard = zones[i].GetComponent <HandZone>().getCard().GetComponent <ThisMonsterCard>();
                    tmCard.summonMonster();

                    GameObject tag = GameObject.Find("SummonTag(Clone)");

                    tag.GetComponent <SummonTag>().summonMonster();
                    i--;
                    yield return(new WaitForSeconds(4 * waitTime));
                }
            }
        }

        thisPlayer.getMonsterHandGameObject().SetActive(false);
        thisPlayer.getAugmentHandGameObject().SetActive(true);

        if (fMonsters.getMonstersInPlay() != 0)
        {
            List <GameObject> zones = aHand.getZones();

            for (int i = 0; i < aHand.getNmbAugmentsInHand(); i++)
            {
                ThisAugmentCard taCard = zones[i].GetComponent <HandZone>().getCard().GetComponent <ThisAugmentCard>();
                taCard.activateAugment();

                GameObject tag = GameObject.Find("ActivateTag(Clone)");
                tag.GetComponent <ActivateTag>().activateEffect();
                i--;
                yield return(new WaitForSeconds(4 * waitTime));
            }
        }

        thisPlayer.getMonsterHandGameObject().SetActive(true);
        thisPlayer.getAugmentHandGameObject().SetActive(false);

        yield return(new WaitForSeconds(4 * waitTime));

        handToggleA2.SetActive(true);

        battle();
    }
Beispiel #3
0
    /* Each player turn:
     * 1. draw and mana gain
     * 2. 2 buttons appear, Battle & EndTurn
     * 3. the player will summon monsters/use augments/powers
     * 4. press Battle => battle phase
     * 5. press EndTurn => the turn is ended
     */

    // The beginning of the match
    // 1. draw the cards
    // 2. set the mana
    IEnumerator drawAtStart(Player player)
    {
        // DRAW MONSTERS

        player.getMonsterHandGameObject().SetActive(true);
        player.getAugmentHandGameObject().SetActive(false);

        // Deck and Hand
        MonsterDeck monsterDeck = player.getMonsterDeckGameObject().GetComponent <MonsterDeck>();
        MonsterHand monsterHand = player.getMonsterHandGameObject().GetComponent <MonsterHand>();
        // MonsterCard var
        MonsterCard monsterCard;

        yield return(new WaitForSeconds(waitTime));

        for (int i = 0; i < 5; i++)
        {
            monsterCard = monsterDeck.getMonsterFromDeck();

            GameObject handZone       = monsterHand.getNextZone();
            GameObject newMonsterCard = Instantiate(monsterCardObject, handZone.transform.position, handZone.transform.rotation) as GameObject;

            newMonsterCard.GetComponent <ThisMonsterCard>().setMonsterCard(monsterCard);
            newMonsterCard.GetComponent <ThisMonsterCard>().setMyPlayer(player);
            newMonsterCard.GetComponent <ThisMonsterCard>().setZoneInHand(handZone);

            newMonsterCard.transform.SetParent(handZone.transform);
            newMonsterCard.transform.position    = handZone.transform.position;
            newMonsterCard.transform.eulerAngles = handZone.transform.eulerAngles;

            handZone.GetComponent <HandZone>().setCard(newMonsterCard);

            monsterHand.setNmbMonstersInHand(monsterHand.getNmbMonstersInHand() + 1);

            yield return(new WaitForSeconds(waitTime));
        }

        // END DRAW MONSTERS

        // DRAW AUGMENTS

        player.getMonsterHandGameObject().SetActive(false);
        player.getAugmentHandGameObject().SetActive(true);

        // Deck and Hand
        AugmentDeck augmentDeck = player.getAugmentDeckGameObject().GetComponent <AugmentDeck>();
        AugmentHand augmentHand = player.getAugmentHandGameObject().GetComponent <AugmentHand>();
        // AugmentCard var
        AugmentCard augmentCard;

        yield return(new WaitForSeconds(waitTime));

        for (int i = 0; i < 5; i++)
        {
            augmentCard = augmentDeck.getAugmentFromDeck();

            GameObject handZone       = augmentHand.getNextZone();
            GameObject newAugmentCard = Instantiate(augmentCardObject, handZone.transform.position, handZone.transform.rotation) as GameObject;

            newAugmentCard.GetComponent <ThisAugmentCard>().setAugmentCard(augmentCard);
            newAugmentCard.GetComponent <ThisAugmentCard>().setMyPlayer(player);
            newAugmentCard.GetComponent <ThisAugmentCard>().setZoneInHand(handZone);

            newAugmentCard.transform.SetParent(handZone.transform);
            newAugmentCard.transform.position    = handZone.transform.position;
            newAugmentCard.transform.eulerAngles = handZone.transform.eulerAngles;

            handZone.GetComponent <HandZone>().setCard(newAugmentCard);

            augmentHand.setNmbAugmentsInHand(augmentHand.getNmbAugmentsInHand() + 1);

            yield return(new WaitForSeconds(waitTime));
        }

        player.getMonsterHandGameObject().SetActive(true);
        player.getAugmentHandGameObject().SetActive(false);

        // END DRAW AUGMENTS
    }