Пример #1
0
        bool PlayerHasCard(int cardInst, int photonId)
        {
            NetworkPrint player = GetPlayer(photonId);
            Card         c      = player.GetCard(cardInst);

            return(c != null);
        }
Пример #2
0
        public void RPC_SyncPlayerHealth(int photonId, int health)
        {
            NetworkPrint p = GetPlayer(photonId);

            p.playerHolder.health = health;
            p.playerHolder.statsUI.UpdateHealth();
        }
Пример #3
0
        public void RPC_PlayerWantsToResetResourcesCards_Master(int photonId)
        {
            NetworkPrint p = GetPlayer(photonId);

            if (gm.localPlayer == p.playerHolder)
            {
                photonView.RPC("RPC_ResetResourcesCardsForPlayer", PhotonTargets.All, photonId);
            }
        }
Пример #4
0
        public void RPC_ResetFlatfootedCardsForPlayer_Master(int photonId)
        {
            NetworkPrint p = GetPlayer(photonId);

            if (gm.localPlayer == p.playerHolder)
            {
                photonView.RPC("RPC_ResetFlatfootedCardsForPlayer", PhotonTargets.All, photonId);
            }
        }
Пример #5
0
        public void RPC_PlayerEndPhase(int photonId)
        {
            NetworkPrint print = GetPlayer(photonId);

            if (print.playerHolder == gm.currentPlayer)
            {
                gm.EndCurrentPhase();
            }
        }
Пример #6
0
        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);
        }
Пример #7
0
        public void PlayerPicksCardFromDeck(PlayerHolder playerHolder)
        {
            NetworkPrint p = GetPlayer(playerHolder.photonId);

            Card c = p.deckCards[0];

            p.deckCards.RemoveAt(0);

            PlayerWantsToUseCard(c.instID, p.photonID, CardOpertation.pickCardFromDeck);
        }
Пример #8
0
        public void AddPlayer(NetworkPrint n_print)
        {
            if (n_print.isLocal)
            {
                localPlayer = n_print;
            }

            players.Add(n_print);
            n_print.transform.parent = multiplayerReferences;
        }
Пример #9
0
        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);
        }
Пример #10
0
        public void RPC_ResetFlatfootedCardsForPlayer(int photonId)
        {
            NetworkPrint p = GetPlayer(photonId);

            foreach (CardInstance c in p.playerHolder.downCards)
            {
                if (c.isFlatfooted)
                {
                    c.SetFlatfooted(false);
                }
            }
        }
Пример #11
0
        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);
        }
Пример #12
0
        public void RPC_ResetResourcesCardsForPlayer(int photonId)
        {
            NetworkPrint p = GetPlayer(photonId);

            p.playerHolder.MakeAllResourceCardUsable();
        }
Пример #13
0
        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;
            }
        }