Example #1
0
    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);
        }
    }
Example #2
0
 private void SendCardToGrimoire(CardVisual card)
 {
     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");
         card.transform.position = new Vector3(0f, 0f, -60f);
     }
 }
Example #3
0
    //private IEnumerator RemoveCardVisualFromField(CardVisual card) {
    //    card.SetCardActiveState(false);
    //    yield return new WaitForSeconds(3f);

    //    if (card.photonView.isMine) {
    //        card.ChangeCardVisualState((int)CardVisual.CardVisualState.ShowFront);
    //        card.RPCChangeCardVisualState(PhotonTargets.Others, CardVisual.CardVisualState.ShowBack);
    //    }

    //    if (card is CreatureCardVisual) {
    //        CreatureCardVisual creature = card as CreatureCardVisual;
    //        creature.RPCToggleExhaust(PhotonTargets.All, false);
    //    }

    //    card.transform.localPosition = new Vector3(-40f, 20f, 20f);

    //}

    private void SendCardToVoid(CardVisual card)
    {
        if (card.photonView.isMine)
        {
            card.ChangeCardVisualState((int)CardVisual.CardVisualState.ShowFront);
            card.RPCChangeCardVisualState(PhotonTargets.Others, CardVisual.CardVisualState.ShowBack);
        }

        if (card is CreatureCardVisual)
        {
            CreatureCardVisual creature = card as CreatureCardVisual;
            creature.RPCToggleExhaust(PhotonTargets.All, false);
        }

        //card.ResetCardData();
        //card.RPCSetUpCardData(PhotonTargets.All);
        //card.SetupCardData();
        if (card.photonView.isMine)
        {
            card.transform.localPosition = new Vector3(-80f, 20f, -40f);
        }
    }
Example #4
0
    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;
        }
    }