Exemplo n.º 1
0
    public void OnEvent(Object messageData, CardsGameClass cardsGameClass)
    {
        switch (messageData.ToString())
        {
        case "openPopup":
            if (!_flagPopup)
            {
                _cardGame = cardsGameClass;
                _classPopup.SetActive(true);
                ActionsWithCard cardDis = _classView.GetComponent <ActionsWithCard>();
                cardDis.CardSetup(_cardGame);
                _classView.gameObject.GetComponent <Animator>().SetBool("view", true);
                _flagPopup = true;
            }
            break;

            /*case "selectClass":
             *  if(_flagPopup)
             *  {
             *      _publisher.Publish(this,"selectClass", cardsClass);
             *      _classPopup.SetActive(false);
             *      _flagPopup = false;
             *  }
             *  break;*/
        }
    }
Exemplo n.º 2
0
    IEnumerator SpawnCardClass()
    {
        _cardClassPrefab = Resources.LoadAll <GameObject>("Prefabs/CardPrefab");
        _allcards        = Resources.LoadAll <CardsGameClass>("CardsClass/");
        _cardInGame      = new GameObject[_allcards.Length];
        //---------------добавляю карты на сцену
        for (int i = 0; i < _allcards.Length; i++)
        {
            _cardInGame[i] = Instantiate(_cardClassPrefab[0], _deck.transform, false);
            _cardInGame[i].transform.localPosition = new Vector3(0, 0f, 0f);
            ActionsWithCard cardDis = _cardInGame[i].GetComponent <ActionsWithCard>();
            cardDis.CardSetup(_allcards[i]);
            _animaManager.SetStateAnima(_cardInGame[i], "dist_num", i + 1);
            yield return(new WaitForSeconds(0.5f));
        }
        //добавляю карту на панель описания класса
        GameObject card = Instantiate(_cardClassPrefab[0], _popupClass.transform, false);

        card.transform.localPosition = new Vector3(-620f, 10f, 0f);
        card.transform.localScale    = new Vector3(1.5f, 1.5f, 0f);

        _classPopup = new PopupClass(_popupClass, card);
        _publisher.AddSubscriber(_classPopup);
    }