public void PlayCard(CardData card, Vector3 position) { // EARLY OUT! // if (card == null) { Debug.LogWarning("Cannot play a null card!"); return; } // EARLY OUT! // if (!CanPlayCard(card)) { Debug.LogWarning("Tried to play a card that couldn't be played: " + card.PrefabName); return; } CardState.PlayCard(card); Mana -= card.ManaCost; ManaChangedEvent.Invoke(); var unit = Entity.SpawnFromDefinition(this, card, position, isFromPlayersHand: true); if (unit != null) { // Rotate the unit to face the enemy bases. RotateForPlayer(unit.gameObject); //TODO: Remove units when out of HP. Units.Add(unit); } }