/// <summary> /// Creates <see cref="CardGrabber"/> instance and initializes it. /// </summary> public CardGrabber DrawCard(Card card, int slotId) { Transform slot = _cardSlots[slotId]; RectTransform region = SelectRegion(card); CardGrabber cardGrabber = Instantiate(_inGameCardPrefab, slot, false); cardGrabber.Init(_stateManager, _connection.BattleConnection.HostId == _connection.Session.UserId); cardGrabber.transform.position = _drawPosition.position; cardGrabber.Initialize(card, slot, _handRegion, region, _canvasScaler); cardGrabber.OnCardPlayed += PlayCard; cardGrabber.OnDragStarted += StartCardDrag; cardGrabber.OnCardReturned += ReturnCard; _cardsInHand.Insert(slotId, cardGrabber); return(cardGrabber); }