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); }
/* 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 }