public void Attached()
 {
     //Call event
     OnHPChanged?.Invoke(_hp);
     OnMoneyChanged?.Invoke(_money);
     OnHonorsChanged?.Invoke();
 }
    public void AddMoney(int _ammount, int _currencyType = 0)
    {
        savegame.currency[_currencyType] += _ammount;


        OnMoneyChanged?.Invoke(savegame.currency[_currencyType], _currencyType);
    }
Exemple #3
0
 public void ChangeMoney(int sumToAdd)
 {
     if (sumToAdd > 0 || Money >= sumToAdd)
     {
         Money += sumToAdd;
         OnMoneyChanged?.Invoke(Money, sumToAdd);
     }
 }
        public Player SetMoney(int m)
        {
            if (m > Config.PLAYER_MAX_MONEY)
            {
                m = Config.PLAYER_MAX_MONEY;
            }

            _money = m;
            OnMoneyChanged?.Invoke(_money);
            return(this);
        }
        public bool CostMoney(int m)
        {
            if (_money - m < 0)
            {
                return(false);
            }

            _money -= m;
            OnMoneyChanged?.Invoke(-m);
            return(true);
        }
        public Player AddMoney(int m)
        {
            _money += m;

            if (_money > Config.PLAYER_MAX_MONEY)
            {
                _money = Config.PLAYER_MAX_MONEY;
            }

            OnMoneyChanged?.Invoke(m);
            return(this);
        }
Exemple #7
0
 /// <summary>
 /// Reduces income by a specified amount
 /// </summary>
 /// <param name="_spentFunds">Income to spend</param>
 public bool SpendFunds(int _spentFunds)
 {
     if (_spentFunds <= funds)
     {
         funds -= _spentFunds;
         UIManager.GetInstance().SetFundsText(funds);
         OnMoneyChanged?.Invoke(funds);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #8
0
    /// <summary>
    /// Adds income based on success and need
    /// </summary>
    public void AddMonthlyIncome()
    {
        UpdateRefugeeValues();

        // for readability and in case we ever want to display these
        int successIncome = Mathf.RoundToInt((weight1 * Mathf.Log(refugeeHealth * refugeeVolume + refugeesResettled)) * multiplier);
        int needIncome    = Mathf.RoundToInt((weight2 * Mathf.Log(refugeeVolume) + 1) * multiplier);
        int monthlyIncome = successIncome + needIncome;

        funds += monthlyIncome;
        Debug.Log("Monthly Income: " + successIncome + "(s) + " + needIncome + "(n) = " + monthlyIncome);
        UIManager.GetInstance().SetFundsText(funds);
        OnMoneyChanged?.Invoke(funds);
    }
    public void ReachedTopOfRope()
    {
        // square the rope is at
        xPos      = 7;
        yPos      = 1;
        zPos      = 0;
        targetPos = GetGridPosition(); // so you stay put
        usingRope = false;

        lastAnchorX = 7;
        lastAnchorY = 1;
        lastAnchorZ = 0;

        UpdateDepth();
        OnRopeEnd?.Invoke();
        // should maybe do a cutscene here
        // also I probably fall in a hole
        // DumpOre()
        money += CalculateMoney();
        OnMoneyChanged?.Invoke(money);
        backPack = 0;
        OnPackFillChanged?.Invoke(backPack, backPackCap);
    }
 public void Pay(int price)
 {
     money -= price;
     OnMoneyChanged?.Invoke(money);
 }
Exemple #11
0
 public void DecrementMoney(int amount)
 {
     _curGameStatistics.Money -= amount;
     OnMoneyChanged?.Invoke(_curGameStatistics.Money);
 }
Exemple #12
0
        public void Sell(TowerData towerData)
        {
            money += towerData.Price;

            OnMoneyChanged?.Invoke(money);
        }
Exemple #13
0
        public void SpendMoney(int amountToSpend)
        {
            money -= amountToSpend;

            OnMoneyChanged?.Invoke(money);
        }
Exemple #14
0
        private void HandleEnemyKilled(EnemyData enemyData)
        {
            money += enemyData.MoneyReward;

            OnMoneyChanged?.Invoke(money);
        }
Exemple #15
0
 /// <summary>
 /// Adds a specified amount of income from an event
 /// </summary>
 /// <param name="_eventFunds">Income to add</param>
 public void AddEventIncome(int _eventFunds)
 {
     funds += _eventFunds;
     UIManager.GetInstance().SetFundsText(funds);
     OnMoneyChanged?.Invoke(funds);
 }
Exemple #16
0
 private void InitializeUI()
 {
     OnRoundChanged?.Invoke(_currentGameStatistics.Rounds.ToString());
     OnMoneyChanged?.Invoke(_currentGameStatistics.Money.ToString());
     OnLivesChanged?.Invoke(_currentGameStatistics.Lives.ToString());
 }
Exemple #17
0
 private void InitializeUI()
 {
     OnRoundChanged?.Invoke(_curGameStatistics.Rounds);
     OnMoneyChanged?.Invoke(_curGameStatistics.Money);
     OnLivesChanged?.Invoke(_curGameStatistics.Lives);
 }
Exemple #18
0
 private static void NotifyMoneyChanged(int balance)
 {
     OnMoneyChanged?.Invoke(_instance.playerData.Money.value);
 }
 private void ChangeMoney(int amount)
 {
     Money += amount;
     OnMoneyChanged?.Invoke(Money);
 }