Exemplo n.º 1
0
    public void Restart()
    {
        int difference = currentScrap - startScrapAmount;

        difference *= -1;

        int         index  = (int)Mathf.Sign(difference);
        ScrapOption option = (ScrapOption)index;

        difference = Mathf.Abs(difference);

        AddOrWithdrawScrap(difference, option);
    }
Exemplo n.º 2
0
    public bool AddOrWithdrawScrap(int amount, ScrapOption option)
    {
        bool success = false;

        amount = Mathf.Abs(amount);
        if (amount > 0)
        {
            if (option == ScrapOption.Add)
            {
                if (currentScrap < maxScrap)
                {
                    currentScrap += amount;
                    if (currentScrap > maxScrap)
                    {
                        currentScrap = maxScrap;
                    }
                    success = true;
                }
            }
            else
            {
                if (currentScrap > 0)
                {
                    currentScrap -= amount;
                    if (currentScrap < 0)
                    {
                        currentScrap = 0;
                    }
                    success = true;
                }
            }
        }
        UpdateScrapAmount();
        TowerManager.singleTM.CheckPricesSetInteractableAndNot();
        return(success);
    }