예제 #1
0
 public void LoadCard()
 {
     if (currentCard.value == null)
     {
         return;
     }
     currentCard.value.gameObject.SetActive(false);
     cardViz.LoadCard(currentCard.value.viz.card);
     cardViz.gameObject.SetActive(true);
 }
예제 #2
0
        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;
            }
        }