Exemplo n.º 1
0
    void OnManaChanged(int mana)
    {
        if (_manaText != null)
        {
            _manaText.text = mana.ToString();
        }

        if (mana >= Settings.MaxMana)
        {
            if (_manaCountdown != null)
            {
                _manaCountdown.text = "FULL";
            }

            _lastManaCountdown = TimeManager.ManaCountdown;
        }

        if (mana > 0)
        {
            NoMoreManaPopupScript script = FindObjectOfType <NoMoreManaPopupScript>();

            if (script != null)
            {
                Manager.Instance.ForceCloseDialog();

                // Force close
                script.ForceClose();

                if (_selectedMap != _userData.Map)
                {
                    // Disable interaction
                    SetInteractable(false);

                    map.JumpToMap(_selectedMap, () => {
                        // Set current map
                        _userData.Map = _selectedMap;

                        // Enable interaction
                        SetInteractable(true);

                        // Show map info
                        ShowMapInfo(_selectedMap);
                    });
                }
                else
                {
                    // Show map info
                    ShowMapInfo(_selectedMap);
                }
            }
        }
    }