Exemple #1
0
    private void OpenThePack(Pack.Expansion expansion)
    {
        _currentExpansion = expansion;
        _cardsBackground.SetActive(true);
        GameObject  card;
        OnCardClick onCardClick;

        for (int i = 0; i < 5; i++)
        {
            DetermineDrop();
            if (i == 4 && _currentRarity == Card.Rarity.Common)
            {
                CommonCheck();
            }

            card = ObjectPool.Instance.GetObjectForType("CardPrefab", true);
            card.transform.SetParent(_canvas.transform, false);
            card.transform.position   = _packReceiver.position;
            card.transform.localScale = Vector3.one;

            onCardClick                = card.GetComponent <OnCardClick>();
            onCardClick._cardRarity    = _currentRarity;
            onCardClick._packExpansion = _currentExpansion;
            onCardClick._endPosition   = _cardSpawnPoints[i].transform.position;
            onCardClick._currentSprite = _currentSprite;
            onCardClick._turnOverSound = _currentAudioClip;

            _activeCards.Add(onCardClick);
        }

        if (OnCardsDetermined != null)
        {
            OnCardsDetermined();
        }
    }
    private void UpdatePacks(Pack.Expansion expansion)
    {
        for (int i = 0; i < _collectionPacks.Count; i++)
        {
            if (_collectionPacks[i].packExpansion == expansion)
            {
                _collectionPacks[i].packCount -= 1;
                break;
            }
        }

        Serializer.Save("packdata.sav", _collectionPacks);
    }
    private IEnumerator EnableDelay()
    {
        yield return(new WaitForEndOfFrame());

        //_eventSystem.enabled = false;
        if (SceneManager.GetActiveScene().name == "openpacks")
        {
            _packReceiver       = GameObject.Find("PackReceiver").transform;
            _colorLerp          = _packReceiver.GetComponent <ColorLerp>();
            _dragParticles      = GameObject.Find("FlowContainer").GetComponentsInChildren <ParticleSystemRenderer>();
            _eventSystem        = GameObject.Find("EventSystem");
            _dragParticles      = GameObject.Find("FlowContainer").GetComponentsInChildren <ParticleSystemRenderer>();
            _eventSystem        = GameObject.Find("EventSystem");
            _backButton         = GameObject.FindWithTag(Tags.SINGLETONTAG).GetComponent <BackButton>();
            _backButton.enabled = false;
            _packTrail          = GameObject.Find("PackTrail").GetComponent <PackTrail>();
        }
        _packExpansion = _onDragBeginPack._packExpansion;
        ChangeFlowVisibility(1);
        _colorLerp.ControlLerp(true);
        _packTrail.packToFollow = transform;
        _packTrail.GetComponent <ParticleSystem>().Play();
    }