private void SendCardToHand(CardVisual card) { //Debug.Log(card.gameObject.name + " is being sent to the hand"); if (owner.handManager.IsCollectionFull()) { Debug.LogWarning("Hand is Full"); //StartCoroutine(SendCardToSoulCrypt(card)); SendCardToSoulCrypt(card); return; } if (card.photonView.isMine) { card.RPCChangeCardVisualState(PhotonTargets.Others, CardVisual.CardVisualState.ShowBack); card.ChangeCardVisualState((int)CardVisual.CardVisualState.ShowFront); //Debug.Log(card.cardData.cardName + " is mine and is showing the card back to others"); } if (!Mulligan.choosingMulligan) { CheckAndActivateCard(card); card.handPos = owner.handManager.GetFirstEmptyCardPosition(card); } else { card.RPCSetCardAciveState(PhotonTargets.All, false); card.handPos = owner.mulliganManager.GetFirstEmptyCardPosition(card); } }
private void CheckAndActivateCard(CardVisual card) { if (!card.active) { card.RPCSetCardAciveState(PhotonTargets.All, true); } }
private void SendCardToBattlefield(CardVisual card) { if (owner == null) { owner = card.owner; } if (card.primaryCardType == Constants.CardType.Soul && owner.battleFieldManager.IsCollectionFull()) { Debug.LogWarning("board is Full"); //SendCardToHand(card); if (card.photonView.isMine) { RPCTransferCard(PhotonTargets.All, card, owner.myHand); } return; } //Debug.Log(card.gameObject.name + " is going to the battlefield"); CheckAndActivateCard(card); switch (card.cardData.primaryCardType) { case Constants.CardType.Player: card.RPCChangeCardVisualState(PhotonTargets.All, CardVisual.CardVisualState.ShowBattleToken); if (card.photonView.isMine) { card.battlefieldPos = owner.battleFieldManager.AssignSpecificPosition(owner.battleFieldManager.transform.Find("PlayerBattlePos"), card); } break; case Constants.CardType.Soul: card.RPCChangeCardVisualState(PhotonTargets.All, CardVisual.CardVisualState.ShowBattleToken); if (card.photonView.isMine) { Transform desiredLocation = owner.battleFieldManager.GetNearestCardPosition(card.gameObject.transform.position); card.battlefieldPos = owner.battleFieldManager.AssignSpecificPosition(desiredLocation, card); owner.battleFieldManager.ClearAllHighlights(); if (card.battlefieldPos == null) { card.battlefieldPos = owner.battleFieldManager.GetFirstEmptyCardPosition(card); } card.transform.position = card.battlefieldPos.position; card.RPCSetCardAciveState(PhotonTargets.All, false); card.RPCSetCardPosition(PhotonTargets.Others, card.battlefieldPos.position); card.DisplaySummoneEffect(); } break; case Constants.CardType.Support: card.RPCChangeCardVisualState(PhotonTargets.All, CardVisual.CardVisualState.ShowBattleToken); if (card.photonView.isMine) { //card.battlefieldPos = owner.battleFieldManager.GetFirstEmptyCardPosition(); card.battlefieldPos = owner.supportPositionManager.GetFirstEmptyCardPosition(card); } break; case Constants.CardType.Spell: if (card.photonView.isMine) { StartCoroutine(SendSpellAway(card)); } break; case Constants.CardType.Domain: card.RPCChangeCardVisualState(PhotonTargets.All, CardVisual.CardVisualState.ShowFront); if (decktype == DeckType.Domain && photonView.isMine) { DomainManager dm = GetComponent <DomainManager>(); dm.RPCActivateDomainTile(PhotonTargets.All); card.transform.localPosition = new Vector3(60f, 60f, -60f); } break; default: break; } }