// -------------------------------------------------------------------------------------------- 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)); }
private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e) { Console.WriteLine(sender.Player.Name + " started turn."); PlayerTurnStarted?.Invoke(sender, EventArgs.Empty); }
public void NextTurn() { CurrentTurn++; player.OnTurnStarted(); PlayerTurnStarted?.Invoke(CurrentTurn); }
// Start is called before the first frame update void Start() { CurrentTurn = 1; PlayerTurnStarted?.Invoke(CurrentTurn); }