/// <summary> /// Starts a match. Creates all necessary game objects and cards. /// </summary> /// <param name="matchInfo">Information about initial state of the match. See MatchInfo.</param> public void StartMatch(MatchInfo matchInfo) { MatchInfo = matchInfo; CreateBoardObjects(); PlayerDeck.FillWithCards(matchInfo.PlayerDeckCards); EnemyDeck.FillWithCards(matchInfo.EnemyDeckCards); PlayerHand.FillWithCards(matchInfo.PlayerStartingHandCards); EnemyHand.FillWithCards(matchInfo.EnemyStartingHandCards); PlayerHero.MaxHealth = PlayerHero.CurrentHealth = matchInfo.PlayerHealth; EnemyHero.MaxHealth = EnemyHero.CurrentHealth = matchInfo.EnemyHealth; PlayerResources.Init(matchInfo.PlayerStartingResource); EnemyResources.Init(matchInfo.EnemyStartingResource); if (matchInfo.PlayerAmountOfCardDrawBeforeGame > 0) { PlayerHand.ImmidiatelyTakeCardsFromDeck(PlayerDeck, matchInfo.PlayerAmountOfCardDrawBeforeGame); } if (matchInfo.EnemyAmountOfCardDrawBeforeGame > 0) { EnemyHand.ImmidiatelyTakeCardsFromDeck(EnemyDeck, matchInfo.EnemyAmountOfCardDrawBeforeGame); } if (matchInfo.PlayerGoesFirst) { StartPlayerTurn(); } else { StartEnemyTurn(); } }