public void SelectCard(CardGameObject cardGO, PlayerCombatObject player, System.Action <CardInHand> SelectCardCallback, System.Action RecalculateCardsPositionCallback) { // Player has selected a card from the hand. // Ignore if it is not player's turn. if (turn != TurnSelection.Players) { infoText.text = "It's not players' turn."; return; } // From here on, it's player's turn. // Ignore if the player is dead. if (player.IsDead) { infoText.text = "Player is knocked out."; return; } // Ignore if the player is disabled. if (!player.IsAbleToAct()) { infoText.text = "Player cannot act."; return; } // Ignore if the player is disarmed and the card is attack. if (cardGO.card.data.type == CardPlayerScriptableObject.Type.Attack && !player.IsAbleToAttack()) { infoText.text = "Player is disarmed."; return; } // Ignore if the player is silenced and the card is spell. if (cardGO.card.data.type == CardPlayerScriptableObject.Type.Spell && !player.IsAbleToCast()) { infoText.text = "Player is silenced."; return; } // Ignore if the player does not have enough mana to play the card. if (cardGO.card.manaCost > player.Mana) { infoText.text = "Not enough mana."; return; } infoText.text = ""; stayUp = true; currentCardOwner = player; currentSelectedCard = cardGO; foreach (var c in coroutines) { StopCoroutine(c); } coroutines.Add(StartCoroutine(SelectTargets(cardGO, SelectCardCallback, RecalculateCardsPositionCallback))); }
public void SelectNativePower(NativePowerScriptableObject nativePower, PlayerCombatObject player) { // Player has selected a native power. // Ignore if it is not player's turn. if (turn != TurnSelection.Players) { infoText.text = "It's not players' turn."; return; } // From here on, it's player's turn. // Ignore if the player is dead. if (player.IsDead) { infoText.text = "Player is knocked out."; return; } // Ignore if the player is disabled. if (!player.IsAbleToAct()) { infoText.text = "Player cannot act."; return; } // Ignore if the player does not have enough mana to activate the power. if (nativePower.manaCost > player.Mana) { infoText.text = "Not enough mana."; return; } infoText.text = ""; currentCardOwner = player; currentPower = nativePower; foreach (var c in coroutines) { StopCoroutine(c); } StartCoroutine(SelectTargets_Power(nativePower)); }