public void BuildNextShaft()
    {
        var position  = Shafts[Shafts.Count - 1].NextShaftTransform.position;
        var newObject = Instantiate(shaftPrefab, position, Quaternion.identity);

        var shaft = newObject.GetComponent <Shaft>();

        Shafts.Add(shaft);
        shaft.ShaftManager = this;
        shaft.Initialize(elevator, financeManager, Shafts.Count);

        financeManager.UpdateMoney(-financeManager.NextShaftPrice);
        financeManager.NextShaftPrice *= settings.ShaftIncrement;
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.N)) // to go to next mine from current mine
        {
            PlayerPrefs.Save();
            if (mine.hasNextMine)
            {
                if (GameSaveDataController.currentMineIndex == GameSaveDataController.totalNumberOfMines)
                {
                    GameSaveDataController.currentMineIndex = 0;
                }
                else
                {
                    GameSaveDataController.currentMineIndex += 1;
                }
            }

            else
            {
                GameSaveDataController.currentMineIndex = 0;
            }

            Save();
            SceneManager.LoadScene(GameSaveDataController.newMineSceneName[GameSaveDataController.currentMineIndex]);
            GameSaveDataController.UpdateSaveInfo();
        }

        if (!mine.canBuyNewMine)
        {
            return;
        }
        if (Input.GetKeyDown(KeyCode.B)) // to buy a new mine
        {
            if (!GameSaveDataController.mineSaveData[GameSaveDataController.currentMineIndex].nextMineUnlocked)
            {
                if (_price <= _financeFinanceManager.TotalMoney)
                {
                    GameSaveDataController.mineSaveData[GameSaveDataController.currentMineIndex].nextMineUnlocked = true;
                    mine.hasNextMine = true;

                    _financeFinanceManager.UpdateMoney(-_price);
                }
            }
        }
    }
Example #3
0
 public void TransferMoney()
 {
     financeManager.UpdateMoney(DrawAll());
 }