Exemple #1
0
    IEnumerator RemoveListener()
    {
        //Multiplayer
        if (!StartGameController.Instance.tutorial)
        {
            int      position = gameObject.transform.GetSiblingIndex();
            object[] data     = new object[] { position, 1, true };
            EffectCommandPun.Instance.SendData(ADJUST_DAMAGE_SYNC_EVENT, data);
        }

        yield return(new WaitForSeconds(2));

        GameManager.Instance.EnableOrDisablePlayerControl(true);

        foreach (Transform t in GameManager.Instance.GetActiveMinionZone(true))
        {
            BuffMinionListener bml = t.gameObject.GetComponent <BuffMinionListener>();

            if (bml)
            {
                Destroy(bml);
            }
        }

        //Add the power to the queue
        EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_BUFF_MINION);

        //Call the Next Power in the Queue
        InvokeEventCommand.InvokeNextEvent();

        UIManager.Instance.RemoveEffectIcon = true;
    }
Exemple #2
0
    public void StartEvent()
    {
        bool      hasMinion = false;
        Transform mz        = GameManager.Instance.GetActiveMinionZone(false);

        foreach (Transform t in mz)
        {
            CardVisual cv = t.GetComponent <CardVisual>();
            if (cv.Md != null)
            {
                hasMinion = true;
            }
        }

        //TODO: If Silence is one of the hero powers, then do a PostNotification for Hero Power Silence).
        if (GameManager.Instance.GetActiveMinionZone(false).childCount == 0 || !hasMinion)
        {
            EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_SILENCE);

            //Call the Next Power in the Queue
            InvokeEventCommand.InvokeNextEvent();
        }
        else
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("Select a Minion to Silence"));
            foreach (Transform t in mz)
            {
                CardVisual cv = t.GetComponent <CardVisual>();
                if (cv.Md != null)
                {
                    t.gameObject.AddComponent <SilenceListener>();
                }
            }
        }
    }
    IEnumerator RemoveListener()
    {
        //Multiplayer
        int position = gameObject.transform.GetSiblingIndex();

        object[] data = new object[] { position, 1, true, true };
        EffectCommandPun.Instance.SendData(ADJUST_HEALTH_SYNC_EVENT, data);

        yield return(new WaitForSeconds(2));

        GameManager.Instance.EnableOrDisablePlayerControl(true);

        foreach (Transform t in GameManager.Instance.GetActiveMinionZone(true))
        {
            HealMinionListener hml = t.gameObject.GetComponent <HealMinionListener>();

            if (hml)
            {
                Destroy(hml);
            }
        }

        //Call Heal Minion Power Effect
        EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_HEAL_MINION);

        //Call the Next Power in the Queue
        InvokeEventCommand.InvokeNextEvent();

        UIManager.Instance.RemoveEffectIcon = true;
    }
Exemple #4
0
    public void OnPointerDown(PointerEventData eventData)
    {
        GameObject card    = eventData.pointerCurrentRaycast.gameObject.transform.parent.gameObject;
        CardVisual cv      = card.GetComponent <CardVisual>();
        Transform  minions = GameManager.Instance.GetActiveMinionZone(false);

        //Multiplayer
        int position = gameObject.transform.GetSiblingIndex();

        object[] data = new object[] { position };
        EffectCommandPun.Instance.SendData(ACTIVATE_SILENCE_SYNC_EVENT, data);

        cv.ActivateSilence(true);

        foreach (Transform t in minions)
        {
            SilenceListener sl = t.GetComponent <SilenceListener>();
            if (sl)
            {
                Destroy(sl);
            }
        }

        EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_SILENCE);
        InvokeEventCommand.InvokeNextEvent();
        UIManager.Instance.RemoveEffectIcon = true;
    }
    public void StartEvent()
    {
        //No Minions
        if (GameManager.Instance.GetActiveMinionZone(false).childCount == 0)
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("Opponent's Hero Shocked!"));

            //Shock oppenent's Hero
            GameManager.Instance.ActiveHero(false).AdjustHealth(1, false);

            //Multiplayer
            object[] data = new object[] { 1 };
            EffectCommandPun.Instance.SendData(ADJUST_HERO_HEALTH_SYNC_EVENT, data);

            //Call the Next Power in the Queue
            InvokeEventCommand.InvokeNextEvent();
        }
        else
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("Select a Minion to Shock"));

            foreach (Transform t in GameManager.Instance.GetActiveMinionZone(false))
            {
                t.gameObject.AddComponent <ShockListener>();
            }
        }

        ////Call the Next Effect in the Queue
        //InvokeEventCommand.InvokeNextEvent();
    }
Exemple #6
0
    public void StartEvent()
    {
        Transform alliedMinions = GameManager.Instance.GetActiveMinionZone(true);
        bool      tapExists     = false;

        foreach (Transform t in alliedMinions)
        {
            if (t.gameObject.GetComponent <CardVisual>().IsTapped)
            {
                tapExists = true;
            }
        }

        if (tapExists)
        {
            GameManager.Instance.instructionsObj.GetComponent <TMP_Text>().text = "Select one tapped Minion to untap";

            foreach (Transform t in alliedMinions)
            {
                t.gameObject.AddComponent <UntapMinionListener>();
            }
        }

        else
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("No tapped minions to untap."));
            InvokeEventCommand.InvokeNextEvent();
        }
    }
Exemple #7
0
    public IEnumerator InvokeDelay(InvokeEventCommand iec)
    {
        ConditionListener cl = iec.card.GetComponent <ConditionListener>();
        int position         = iec.card.transform.GetSiblingIndex();

        object[] data = new object[] { position };

        if (!StartGameController.Instance.tutorial)
        {
            if (cl.ConditionEvent == EVENT_TYPE.TAP_MINION)
            {
                PhotonNetwork.RaiseEvent(TAP_ANIMATION_SYNC_EVENT, data, new RaiseEventOptions {
                    Receivers = ReceiverGroup.Others
                },
                                         SendOptions.SendReliable);
            }
            else
            {
                PhotonNetwork.RaiseEvent(ANIMATION_SYNC_EVENT, data, new RaiseEventOptions {
                    Receivers = ReceiverGroup.Others
                },
                                         SendOptions.SendReliable);
            }
        }

        DelayCommand dc = new DelayCommand(iec.card.transform, 2f);

        dc.AddToQueue();

        GameManager.Instance.effectText.gameObject.SetActive(true);
        yield return(new WaitForSeconds(2.5f));

        GameManager.Instance.effectText.gameObject.SetActive(false);

        iec.method.Invoke(iec.cardType, new object[] { });

        CardVisual cv = iec.card.GetComponent <CardVisual>();

        if (!StartGameController.Instance.tutorial)
        {
            if (cl.ConditionEvent == EVENT_TYPE.TAP_MINION && InvokeEventCommand.InvokeEventQueue.Count == 0)
            {
                cv.AdjustHealth(1, false);
            }
        }
        else
        {
            if (InvokeEventCommand.InvokeEventQueue.Count == 0)
            {
                cv.AdjustHealth(1, false);
            }
        }
    }
    public void StartEvent()
    {
        if (!GameManager.Instance.HasExpressBuy)
        {
            StartCoroutine(ShowEffectAnimation());

            GameManager.Instance.HasExpressBuy = true;
            GameManager.Instance.expressBuyImage.gameObject.SetActive(true);

            //Call the Next Power in the Queue
            InvokeEventCommand.InvokeNextEvent();
        }
    }
Exemple #9
0
    private IEnumerator Delay()
    {
        GameManager.Instance.DrawCard(UIManager.Instance.GetActiveDeckList(true), GameManager.Instance.GetActiveHand(true));
        yield return(new WaitForSeconds(1.5f));

        GameManager.Instance.GetActiveHand(true).GetChild(GameManager.Instance.GetActiveHand(true).childCount - 1).gameObject.AddComponent <PlayCard>();

        //Call the Next Power in the Queue
        InvokeEventCommand.InvokeNextEvent();

        if (StartGameController.Instance.tutorial)
        {
            StartGameController.Instance.TutorialObject.GetComponent <TutorialTextController>().ShowUI();
        }
    }
Exemple #10
0
    public void StartCommandExecution()
    {
        if (!inEffect)
        {
            inEffect = true;

            EVENT_TYPE effect = EffectQueue.Dequeue();

            if (effect != EVENT_TYPE.TAP_MINION)
            {
                EventManager.Instance.PostNotification(effect);
            }

            InvokeEventCommand.InvokeNextEvent();
        }
    }
Exemple #11
0
    public void StartEvent()
    {
        bool needToHeal = false;

        //Loop through each Minion and Compare to see if any minion is already at full health
        foreach (Transform t in GameManager.Instance.GetActiveMinionZone(true))
        {
            CardVisual cv = t.GetComponent <CardVisual>();

            if (cv.IsPromoted)
            {
                if (cv.CurrentHealth < cv.PromotedHealth)
                {
                    needToHeal = true;
                }
            }
            else
            {
                if (cv.CurrentHealth < cv.TotalHealth)
                {
                    needToHeal = true;
                }
            }
        }

        if (needToHeal)
        {
            //Display Start message
            GameManager.Instance.instructionsObj.GetComponent <TMP_Text>().text = "Select one Minion to Heal";

            //Disable Player Interaction
            GameManager.Instance.EnableOrDisablePlayerControl(false);

            //Assign each Minion a Listener Script
            foreach (Transform t in GameManager.Instance.GetActiveMinionZone(true))
            {
                t.gameObject.AddComponent <HealMinionListener>();
            }
        }
        else
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("All Minions are Currently at Full Health"));

            //Call the Next Power in the Queue
            InvokeEventCommand.InvokeNextEvent();
        }
    }
Exemple #12
0
    public void OnPointerDown(PointerEventData eventData)
    {
        GameObject card = eventData.pointerCurrentRaycast.gameObject.transform.parent.gameObject;
        CardVisual cv   = card.GetComponent <CardVisual>();

        if (cv.CurrentHealth - 1 == 0)
        {
            EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.MINION_DEFEATED);
        }

        cv.AdjustHealth(1, false);

        //Multiplayer
        int position = gameObject.transform.GetSiblingIndex();

        if (!StartGameController.Instance.tutorial)
        {
            object[] data = new object[] { position, 1, false, false };
            EffectCommandPun.Instance.SendData(ADJUST_HEALTH_SYNC_EVENT, data);
        }

        foreach (Transform t in GameManager.Instance.GetActiveMinionZone(false))
        {
            ShockListener sl = t.GetComponent <ShockListener>();
            if (sl)
            {
                Destroy(sl);
            }
        }

        if (GameManager.Instance.InHeroPower)
        {
            GameManager.Instance.InHeroPower = false;
            EffectCommand.Instance.inEffect  = false;
        }
        else
        {
            //Call the Next Power in the Queue
            InvokeEventCommand.InvokeNextEvent();
            UIManager.Instance.RemoveEffectIcon = true;
        }

        if (StartGameController.Instance.tutorial)
        {
            StartGameController.Instance.TutorialObject.GetComponent <TutorialTextController>().ShowUI();
        }
    }
Exemple #13
0
    public void MoveCardsToBottom()
    {
        //Move Selected Cards to the bottom of the deck
        if (moveCards.Count != 0)
        {
            UIManager.Instance.MoveTopCardsToBottom(moveCards.First().CardClass, moveCards);
        }

        //Delete all GameObjects inside of the BigCard View in the shop
        GameObject cardGroup = GameManager.Instance.shop.gameObject.GetComponent <ShopController>().cardGroup;

        foreach (Transform tmp in cardGroup.transform)
        {
            Destroy(tmp.gameObject);
        }

        //Re-enable the shop view
        EnableShop();

        //Call the effect on the other screen
        int[] minionList = new int[moveCards.Count];
        for (int i = 0; i < moveCards.Count; i++)
        {
            minionList[i] = moveCards[i].MinionID;
        }

        object[] data = new object[] { moveCards.First().CardClass, minionList };
        PhotonNetwork.RaiseEvent(PEEK_SHOP_SYNC_EVENT, data, new RaiseEventOptions {
            Receivers = ReceiverGroup.Others
        },
                                 SendOptions.SendReliable);

        //Delete all objects in moveCards
        moveCards.Clear();

        //Call Peek Shop Power Effect
        //EventManager.Instance.PostNotification(EVENT_TYPE.POWER_PEEK_SHOP);
        EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_PEEK_SHOP);

        //Call the Next Power in the Queue
        InvokeEventCommand.InvokeNextEvent();

        UIManager.Instance.RemoveEffectIcon = true;
    }
Exemple #14
0
    public void UntapMinion(CardVisual cv)
    {
        Transform alliedMinions = GameManager.Instance.GetActiveMinionZone(true);

        if (cv.IsTapped)
        {
            cv.IsTapped = false;
            cv.ChangeTappedAppearance();

            bool isMinion = false;
            int  cardId;
            if (cv.Md)
            {
                isMinion = true;
                cardId   = cv.Md.MinionID;
            }
            else
            {
                cardId = cv.Sd.StarterID;
            }

            object[] data = new object[] { isMinion, cardId };
            PhotonNetwork.RaiseEvent(UNTAP_SYNC_EVENT, data, new RaiseEventOptions {
                Receivers = ReceiverGroup.Others
            },
                                     SendOptions.SendReliable);

            //removes all untap listeners from all minions on the active player's board
            foreach (Transform t in alliedMinions)
            {
                Destroy(t.gameObject.GetComponent <UntapMinionListener>());
            }

            InvokeEventCommand.InvokeNextEvent();

            UIManager.Instance.RemoveEffectIcon = true;
        }
        else
        {
            StartCoroutine(GameManager.Instance.SetInstructionsText("This Minion is not currently tapped, please select a Minion to untap"));
        }
    }
Exemple #15
0
    public void RecycleConfirmButton()
    {
        if (UIManager.Instance.LastSelectedCard)
        {
            object[] data = new object[] { GameManager.Instance.RemoveCardAtIndex };
            PhotonNetwork.RaiseEvent(RECYCLE_SYNC_EVENT, data, new RaiseEventOptions {
                Receivers = ReceiverGroup.Others
            },
                                     SendOptions.SendReliable);

            CardVisual cv = UIManager.Instance.LastSelectedCard.GetComponent <CardVisual>();
            //move the selected card to top of the deck.
            deckList = UIManager.Instance.GetActiveDeckList(true);
            deckList.Insert(0, cv.GetCardData());

            TMP_Text deckCounter = GameManager.Instance.GetActiveDeck(true).transform.Find("DeckCounter").GetComponent <TMP_Text>();
            deckCounter.text = deckList.Count.ToString();

            Destroy(GameManager.Instance.GetActiveDiscardPile(true).GetChild(GameManager.Instance.RemoveCardAtIndex).gameObject);
            UIManager.Instance.GetActiveDiscardList(true).RemoveAt(GameManager.Instance.RemoveCardAtIndex);
            GameManager.Instance.RemoveCardAtIndex = -1;

            //Add the power to the Queue
            EffectCommand.Instance.EffectQueue.Enqueue(EVENT_TYPE.POWER_RECYCLE);
        }

        GameManager.Instance.GetActiveDiscardUI(true).gameObject.SetActive(false);
        SetupRecycleUI(false);
        GameManager.Instance.allyDiscardPileButton.interactable  = true;
        GameManager.Instance.enemyDiscardPileButton.interactable = true;

        //Call the Next Effect in the Queue
        InvokeEventCommand.InvokeNextEvent();

        UIManager.Instance.RemoveEffectIcon = true;
    }
Exemple #16
0
 public void InvokeMethod(InvokeEventCommand iec)
 {
     StartCoroutine(InvokeDelay(iec));
 }