Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator TakeTurn() { // AI programming for a given turn
- takingTurn = true;
- while(GameManager.gm.Turn == Order) {
- switch (GameManager.gm.CurrentState) {
- case GameManager.States.Wait:
- if (!MovesAvailable()) { // No moves! Draw a card
- AddCard(GameManager.GameDeck.Draw());
- if (!MovesAvailable()) // Still no moves! End turn
- GameManager.gm.IncrementTurn();
- }
- else { // grab the first selectable card and play it. Might improve on this in later versions.
- foreach(Card c in Hand)
- if (c.Model.GetComponent<CardBehavior>().isSelectable) {
- RemoveCard(c);
- // Playing a card will re-parent the card and increment the turn counter accordingly.
- GameManager.gm.PlayCard(c, Order);
- }
- }
- break;
- case GameManager.States.Draw:
- while(GameManager.gm.DrawCount > 0) {
- AddCard(GameManager.GameDeck.Draw());
- GameManager.gm.DrawCount--;
- }
- GameManager.gm.IncrementTurn();
- break;
- /*case GameManager.States.ChooseColor:
- break;*/ // Currently, color selection is initiated by the game manager.
- }
- yield return new WaitForSeconds(2.5f); // make sure everything doesn't happen instantaneously
- }
- takingTurn = false;
- yield break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement