public void AddGold(short goldToAdd)
    {
        string decodingGold = B64X.Decode(gold);
        short  existsGold   = short.Parse(decodingGold);

        existsGold += goldToAdd;
        gold        = B64X.Encode(existsGold.ToString());
        WriteGoldCount();
    }
 void Awake()
 {
     SetHeroesToButton();
     SetSpeelToButton();
     ownTransform  = transform;
     gold          = B64X.Encode(startedGold.ToString());
     backgroundSR  = background.GetComponent <SpriteRenderer>();
     currentCamera = ownTransform.GetComponent <Camera>();
     maxCameraSize = currentCamera.orthographicSize;
     minCameraSize = maxCameraSize - 1f;
 }
    /// <summary>
    /// Потерять жизнь
    /// </summary>
    /// <param name="amount">Количество</param>
    public void LoseLife(int amount = 1)
    {
        string currentLiveDecodedStr = B64X.Decode(currentLivesCount);
        int    currentLiveDecoded    = int.Parse(currentLiveDecodedStr);

        currentLiveDecoded -= amount;

        currentLivesCount = B64X.Encode(currentLiveDecoded.ToString());

        OnLivesCountChange.Invoke();

        if (currentLiveDecoded == 0)
        {
            EndGame();
        }
    }
    /// <summary>
    /// Добавить золото
    /// </summary>
    /// <param name="amount">Количество</param>
    public void AddGold(int amount)
    {
        // Расшифровываем
        string decodingGold = B64X.Decode(currentGold);
        int    existsGold   = int.Parse(decodingGold);

        // Прибавляем
        existsGold += amount;

        // Кодируем обратно
        string encodingGold = B64X.Encode(existsGold.ToString());

        currentGold = encodingGold;

        OnGoldChange.Invoke();
    }
 /// <summary>
 /// Инициализация стартовых данных
 /// </summary>
 void InitializeStartStats()
 {
     currentGold       = B64X.Encode(startGold.ToString());
     currentLivesCount = B64X.Encode(startLivesCount.ToString());
 }