void OnInputEnded(Vector2 startPosition, Vector2 position, float deltaTime) { var selectedCard = _selectedCard; _selectedCard = null; var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out var hit, maxDistance: Mathf.Infinity, layerMask: 1 << 10)) { for (var i = 0; i < Arena.Lanes.Length; ++i) { var lane = Arena.Lanes[i]; if (lane.transform == hit.transform) { var card = selectedCard.Card; selectedCard.Slot.RemoveCard(); OnUseCard?.Invoke(card, i); } } } }
private void UseCard(GamePlayer gamePlayer, CardRecord cardRecord) { gamePlayer.RemainedManaCrystal -= cardRecord.ManaCost; gamePlayer.RemoveHandCard(cardRecord.CardRecordID); OnUseCard?.Invoke(this, gamePlayer, cardRecord); }