Esempio n. 1
0
    private void AssignDamageToAttackers()
    {
        foreach (GameObject card in GameManager.Instance.MinionsAttacking)
        {
            CardVisual        cv = card.GetComponent <CardVisual>();
            ConditionListener cl = card.GetComponent <ConditionListener>();

            if (cv.Md != null && cl != null)
            {
                if ((cl.ConditionEvent == EVENT_TYPE.BLEED || cl.ConditionEvent == EVENT_TYPE.MINION_DEFEATED) && (cv.CurrentHealth - 1) == 0)
                {
                    minionsLeft.Add(cv);
                }
                else
                {
                    cv.AdjustHealth(1, false);
                }
            }
            else
            {
                cv.AdjustHealth(1, false);
            }
        }

        if (minionsLeft.Count > 0)
        {
            attackAfter = true;
        }

        GameManager.Instance.MinionsAttacking.Clear();
    }
Esempio n. 2
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);
            }
        }
    }