/// <summary> /// Called to set up the beginning of a turn and the event card of that turn /// </summary> public void BeginTurn() { Debug.Log("Turn has begun"); //Temp testing info Debug.Log("Global Stats: Money: " + Money + " | C02: " + Carbon + " | Hope : " + Hope); //Pull an event card and remove it from the deck activeEventCard = CurrentEventDeck[0]; CurrentEventDeck.RemoveAt(0); //Display Card info Debug.Log("Card Event: " + activeEventCard.cardName); Debug.Log("Card Description: " + activeEventCard.cardDesc); Debug.Log("Card Stats Money: " + activeEventCard.costMoney + " | CO2: " + activeEventCard.costCarbon + " | Hope: " + activeEventCard.hope); EventCardDisplay.Instance.SetCardAndDisplay(activeEventCard); //Update Money, Carbon and Hope Money += activeEventCard.costMoney; Carbon += activeEventCard.costCarbon; Hope += activeEventCard.hope; //Display updated stats Debug.Log("Global Stats: Money: " + Money + " | C02: " + Carbon + " | Hope : " + Hope); //Warn if hope card must be played if (PlayerMustPlayHope()) { Debug.Log("A positive hope card must be played"); } HandManager.Instance.SetCardDisplays(newCards); PrintPlayerHand(); // The game should not *automatically* end here // Left this in in case its used in the future /* * if (PlayerMustPlayHope() && !PlayerHasHopeCard() && Money < 5) * { * * Debug.Log("There are no valid hope cards in your hand and you " + * "do not have enough money to redraw your hand. You lose"); * // gameOver = true; * // TurnActive = false; * // EndTurn(); * } else * { * TurnActive = true; * } */ TurnActive = true; CurrentTurnNumber += 1; }
/// <summary> /// Turns the entire list of event cards into a shuffled deck /// </summary> public void GenerateEventDeck() { do { //Generate random number to choose a card from master queue int ranNum = Random.Range(0, CardDataCompiler.Instance.MasterEventDeck.Count); //Add chosen card to queue of action deck that player draws from CurrentEventDeck.Add(CardDataCompiler.Instance.MasterEventDeck[ranNum]); //Remove added card from master queue to avoid duplicates CardDataCompiler.Instance.MasterEventDeck.RemoveAt(ranNum); } while (CardDataCompiler.Instance.MasterEventDeck.Count > 0); }
/// <summary> /// Called to end the player's current turn and set up for next turn /// </summary> public void EndTurn() { //Display that the turn has ended Debug.Log("Turn Ended"); //Check if the card has a super event card if (CardDataCompiler.Instance.SuperNegativeEventCards.ContainsKey(activeEventCard.cardName)) { //Increment the cards supercastrophe potential CurrentEventDeck.Insert(Random.Range(0, CurrentEventDeck.Count), CardDataCompiler.Instance.SuperNegativeEventCards[activeEventCard.cardName]); } //Update based on player cards for (int i = 0; i < activePlayerCardCount; i++) { //update money Money += activePlayerCards[i].costMoney; //update carbon cost Carbon += activePlayerCards[i].costCarbon; //update hope card Hope += activePlayerCards[i].hope; } //check momentum for super positive event and if there are remaining super positive cards to be played if (activePlayerCardCount >= 3 && CardDataCompiler.Instance.PositiveEventCards.Count > 0) { CurrentEventDeck.Insert(Random.Range(0, CurrentEventDeck.Count), CardDataCompiler.Instance.PositiveEventCards[ Random.Range(0, CardDataCompiler.Instance.PositiveEventCards.Count)]); } //Clear activeplayercards and reset counter for (int j = 0; j < activePlayerCards.Length; j++) { activePlayerCards[j] = null; } CardCatcher.Instance.ClearCaughtCards(); //reset counter activePlayerCardCount = 0; //reset values TurnActive = false; Momentum = 0; validPos = true; //Temporarily display stats Debug.Log("Global Stats: Money: " + Money + " | C02: " + Carbon + " | Hope : " + Hope); //reset currentCard values currentCard = null; currentCardIndex = 0; //Replenish player hand DrawCards(); // CHECK GAME END CONDITIONS // Check if money is less than zero if (Money < 0) { GameEnd(); } // Check if carbon is 30 or greater if (Carbon >= 30) { GameEnd(); } // Check if all hope is gone if (Hope <= MIN_HOPE) { GameEnd(); } //If game is not over, begin next turn if (!gameOver) { BeginTurn(); } }