bool PlayerHasCard(int cardInst, int photonId) { NetworkPrint player = GetPlayer(photonId); Card c = player.GetCard(cardInst); return(c != null); }
public void AddPlayer(NetworkPrint n_print) { if (n_print.isLocal) { localPlayer = n_print; } players.Add(n_print); n_print.transform.parent = multiplayerReferences; }
public void RPC_PlayerCreatesCard(int photonId, int instId, string cardName) { Card c = gm.resourcesManager.GetCardInstance(cardName); c.instId = instId; NetworkPrint p = GetPlayer(photonId); p.AddCard(c); }
public void PlayerPicksCardFromDeck(PlayerHolder playerHolder) { NetworkPrint p = GetPlayer(playerHolder.photonId); if (p.deckCards.Count == 0) { // get all graveyard cards and reshuffle them into a new deck Debug.Log("shuffling deck"); return; } Card c = p.deckCards[0]; p.deckCards.RemoveAt(0); Debug.Log("attemtping to use card for player" + p.photonId); PlayerWantsToUseCard(c.instId, p.photonId, CardOperation.pickCardFromDeck); PlayerWantsToUseCard(c.instId, p.photonId, CardOperation.syncDeck); }
public void RPC_PlayerUsesCard(int instId, int photonId, CardOperation operation) { NetworkPrint p = GetPlayer(photonId); Card card = p.GetCard(instId); switch (operation) { case CardOperation.dropStableType: Debug.Log("Online Player placing stable down"); Settings.DropCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.stableAreaGrid.value, card.cardPhysicalInst); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOperation.dropStableTypeEnemy: Debug.Log("Online Player placing enemy stable down"); Settings.DropCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.enemyStableAreaGrid.value, card.cardPhysicalInst); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOperation.dropMagicalUnicornType: Debug.Log("Online Player placing unicorn down"); Settings.DropCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.unicornAreaGrid.value, card.cardPhysicalInst); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOperation.dropMagicalUnicornTypeEnemy: Debug.Log("Online Player placing enemy unicorn down"); Settings.DropCard(card.cardPhysicalInst.transform, p.playerHolder.currentHolder.enemyUnicornAreaGrid.value, card.cardPhysicalInst); card.cardPhysicalInst.currentLogic = dataHolder.cardDownLogic; card.cardPhysicalInst.gameObject.SetActive(true); break; case CardOperation.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.handLogic; Settings.SetParentForCard(go.transform, p.playerHolder.currentHolder.handGrid.value); p.playerHolder.handCards.Add(card.cardPhysicalInst); break; case CardOperation.syncDeck: // Debug.Log("player" + photonId + "drew" + instId); foreach (NetworkPrint player in players) { if (player.photonId != photonId) { // Debug.Log("removing" + instId + "for player" + player.photonId); player.deckCards.RemoveAt(0); } } break; default: break; } }