Exemplo n.º 1
0
    public void AddGold(short goldToAdd)
    {
        string decodingGold = B64X.Decode(gold);
        short  existsGold   = short.Parse(decodingGold);

        existsGold += goldToAdd;
        gold        = B64X.Encode(existsGold.ToString());
        WriteGoldCount();
    }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
    /// <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();
        }
    }
Exemplo n.º 4
0
    /// <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();
    }
Exemplo n.º 5
0
 /// <summary>
 /// Инициализация стартовых данных
 /// </summary>
 void InitializeStartStats()
 {
     currentGold       = B64X.Encode(startGold.ToString());
     currentLivesCount = B64X.Encode(startLivesCount.ToString());
 }