Пример #1
0
        // --------------------------------------------------------------------------------------------
        public void StartTurn()
        {
            _energyCap++;
            _energyCap = Mathf.Min(_energyCap, AppManager.Config.MaxPlayerEnergy);

            // refill energy by taking it from the player's Source
            int amountFromSource = Mathf.Min(_energyCap - _energy, Source);

            _energy += amountFromSource;
            Source  -= amountFromSource;

            // draw a card if there are any cards left
            if (_deck.NumCardsLeft > 0)
            {
                if (_hand.Cards.Count < AppManager.Config.MaxHandSize)
                {
                    _hand.DrawCard();
                }
                else
                {
                    // TODO: lots of games have a penalty when the player has too many cards in their hand
                    // Do that here.
                }
            }

            PlayerTurnStarted?.Invoke(this, new PlayerEventArgs(this));
        }
Пример #2
0
        private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " started turn.");

            PlayerTurnStarted?.Invoke(sender, EventArgs.Empty);
        }
Пример #3
0
 public void NextTurn()
 {
     CurrentTurn++;
     player.OnTurnStarted();
     PlayerTurnStarted?.Invoke(CurrentTurn);
 }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     CurrentTurn = 1;
     PlayerTurnStarted?.Invoke(CurrentTurn);
 }