Exemple #1
0
 public void Initialize(HudGameplayController hudGameplay)
 {
     SetState(CoinObjectState.Coin);
     _currentChestCounter   = null;
     _hudGameplayController = hudGameplay;
     _hudCoinTarget         = hudGameplay.GetCoinHudTargetTransform();
 }
Exemple #2
0
    private void SetState(CoinObjectState state)
    {
        _state = state;
        var isCoin = state == CoinObjectState.Coin;

        _animator.SetBool("Coin", isCoin);
        _coinSpriteObj.SetActive(isCoin);
        _animator.SetBool("Chest", !isCoin);
        _chestSpriteObj.SetActive(!isCoin);
        _currentSpriteObj = isCoin ? _coinSpriteObj : _chestSpriteObj;
        if (isCoin && _currentChestCounter != null)
        {
            _currentChestCounter.OnFinish();
            _currentChestCounter = null;
        }
    }
Exemple #3
0
    private IEnumerator RunChestCountdown()
    {
        _currentChestCounter = Instantiate <ChestCounterLogic>(_chestCounterPrefab);
        _hudGameplayController.AddToGameplayUI(_currentChestCounter.transform);
        _currentChestCounter.Initialize(_chestSpriteObj.transform);
        float countDown = _chestSpawnCountdown;

        while (countDown > 0.0f && _currentChestCounter != null)
        {
            _currentChestCounter.UpdateValue(countDown);
            countDown -= Time.deltaTime;
            yield return(null);
        }

        if (_state == CoinObjectState.Chest)
        {
            SetState(CoinObjectState.Coin);
        }
    }