public void RPC_PlayerBlocksTargetCard_Client(int cardInst, int photonId, int targetInst, int blocked, int count) { NetworkPrint playerBlocker = GetPlayer(photonId); Card blockerCard = playerBlocker.GetCard(cardInst); NetworkPrint blockedPlayer = GetPlayer(blocked); Card blockedCard = playerBlocker.GetCard(targetInst); Settings.SetCardForBlock(blockerCard.cardPhysicalInst.transform, blockedCard.cardPhysicalInst.transform, count); }
bool PlayerHasCard(int cardInst, int photonId) { NetworkPrint player = GetPlayer(photonId); Card c = player.GetCard(cardInst); return(c != null); }
public void RPC_PlayerBlocksTargetCard_Master(int cardInst, int photonId, int targetInst, int blocked) { NetworkPrint playerBlocker = GetPlayer(photonId); Card blockerCard = playerBlocker.GetCard(cardInst); NetworkPrint blockedPlayer = GetPlayer(blocked); Card blockedCard = blockedPlayer.GetCard(targetInst); int count = 0; Settings.gameManager.AddBlockInstance(blockedCard.cardPhysicalInst, blockerCard.cardPhysicalInst, ref count); photonView.RPC("RPC_PlayerBlocksTargetCard_Client", PhotonTargets.All, cardInst, photonId, targetInst, blocked, count); }
public void RPC_PlayerUsesCard(int instId, int photonId, CardOpertation operation) { NetworkPrint p = GetPlayer(photonId); Card card = p.GetCard(instId); switch (operation) { case CardOpertation.dropResourcesCard: Settings.SetParentForCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.resourcesGrid.value); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; p.playerHolder.AddResourceCard(card.cardPhysicalInst.gameObject); card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOpertation.pickCardFromDeck: GameObject go = Instantiate(dataHolder.cardPrefab) as GameObject; CardViz v = go.GetComponent <CardViz>(); v.LoadCard(card); card.cardPhysicalInst = go.GetComponent <CardInstance>(); card.cardPhysicalInst.currentLogic = dataHolder.handCard; card.cardPhysicalInst.owner = p.playerHolder; Settings.SetParentForCard(go.transform, p.playerHolder.currentHolder.handGrid.value); p.playerHolder.handCards.Add(card.cardPhysicalInst); break; case CardOpertation.dropCreatureCard: bool canUse = p.playerHolder.CanUseCard(card); if (canUse) { Settings.DropHeroCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.downGrid.value, card.cardPhysicalInst); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; } else { Settings.RegisterEvent("Not enough resources to use card", Color.red); } card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOpertation.setCardForBattle: if (p.playerHolder.attackingCards.Contains(card.cardPhysicalInst)) { p.playerHolder.attackingCards.Remove(card.cardPhysicalInst); p.playerHolder.currentHolder.SetCardsOffBatlleLine(card.cardPhysicalInst); } else { if (card.cardPhysicalInst.CanAttack()) { p.playerHolder.attackingCards.Add(card.cardPhysicalInst); p.playerHolder.currentHolder.SetCardsOnBatlleLine(card.cardPhysicalInst); } } break; case CardOpertation.cardToGraveyard: card.cardPhysicalInst.CardInstanceToGraveyard(); break; default: break; } }