コード例 #1
0
 public void UpgradeFactory()
 {
     _manager._factoryOuput[_type] += _perDay;
     _perDay *= 2;
     WM_UI.UpdateUI();
     UpgradeCost();
 }
コード例 #2
0
 public void Activate()
 {
     if (!_active && _affordable)
     {
         _activeFactory._factoryLevel++;
         PayResources();
         _activeFactory._active = true;
         _activeFactory.SwitchMesh();
         _activeFactory.UpgradeCost();
         _manager._factoryOuput[_type] += _amount;
         _activeFactory.Names();
         Time.timeScale = 1.0f;
         _factoryPrompt.SetActive(false);
         _mapToggle.SetActive(true);
         WM_UI.UpdateUI();
     }
     else if (_affordable)
     {
         if (_activeFactory._factoryLevel < 3)
         {
             _activeFactory._factoryLevel++;
             PayResources();
             _activeFactory.UpgradeFactory();
             _activeFactory.SwitchMesh();
             _activeFactory.Names();
             _factoryPrompt.SetActive(false);
             _mapToggle.SetActive(true);
             Time.timeScale = 1.0f;
         }
     }
 }
コード例 #3
0
    public void BuyPart(int part)
    {
        switch (part)
        {
        case 0:
            _partA = true;
            _partAbutton.interactable = false;
            _manager._resources[0]   -= 1000;
            break;

        case 1:
            _partB = true;
            _partBbutton.interactable = false;
            _manager._resources[3]   -= 1000;
            break;

        case 2:
            _partC = true;
            _partCbutton.interactable = false;
            _manager._resources[4]   -= 1000;
            break;

        case 3:
            _partD = true;
            _partDbutton.interactable = false;
            _manager._resources[5]   -= 1000;
            break;
        }
        UpdateButtons();
        WM_UI.UpdateUI();
        _built = (_partA && _partB && _partC && _partD);
    }
コード例 #4
0
 public void SellResource(int resource)
 {
     if (_manager._resources[resource] >= _multiple)
     {
         _manager._resources[resource] -= _multiple;
         _manager._obols += (_townManager._sellPrices[resource] * _multiple);
         UpdatePrices();
         WM_UI.UpdateUI();
     }
 }
コード例 #5
0
 public void BuyResource(int resource)
 {
     if (_manager._obols >= (_multiple * _townManager._buyPrices[resource]))
     {
         _manager._resources[resource] += _multiple;
         _manager._obols -= (_townManager._buyPrices[resource] * _multiple);
         UpdatePrices();
         WM_UI.UpdateUI();
     }
 }
コード例 #6
0
ファイル: TownCanvas.cs プロジェクト: kcreanor87/Shetland
    public void CloseCanvas()
    {
        _mapToggle.SetActive(true);
        _canvas.enabled = false;
        Time.timeScale  = 1.0f;
        WM_UI.UpdateUI();
        _saveGame.Save();
        var pos = _townManager.transform.FindChild("Entrance").position;

        print(pos);
        _saveGame.SaveLastTownPos(pos);
        _dayTimer.GenerateEnemies();
    }
コード例 #7
0
ファイル: TownCanvas.cs プロジェクト: kcreanor87/Shetland
 public void PurchaseBuilding()
 {
     _manager._resources[0] -= _buildingCosts[_activeBuilding]._woodCost;
     _manager._resources[1] -= _buildingCosts[_activeBuilding]._stoneCost;
     _manager._resources[2] -= _buildingCosts[_activeBuilding]._ironCost;
     _manager._resources[3] -= _buildingCosts[_activeBuilding]._coalCost;
     WM_UI.UpdateUI();
     _townManager._activeBuildings[_activeBuilding] = true;
     UpdateWorkshopButtons();
     UpgradableBuildingNames();
     _buildingCanvas[7].SetActive(false);
     _market.UpdatePrices();
 }
コード例 #8
0
ファイル: DayTimer.cs プロジェクト: kcreanor87/Shetland
 void EndOfDay(bool restart)
 {
     _manager._resources[0] += _manager._factoryOuput[0];
     _manager._resources[1] += _manager._factoryOuput[1];
     _manager._resources[2] += _manager._factoryOuput[2];
     _manager._resources[3] += _manager._factoryOuput[3];
     WM_UI.UpdateUI();
     ResetPrices();
     _saveGame.Save();
     GenerateEnemies();
     if (restart)
     {
         StartCoroutine(Timer());
     }
 }
コード例 #9
0
 void CalculateOptions()
 {
     //Activate and deactivate GameObjects based on current stats
     CheckBuildStatus();
     CheckResources();
     _build.SetActive(!_built);
     _buy.SetActive(_manager._obols >= _cost && !_bought);
     _brag.SetActive(_manager._repute >= _fameRequired && !_bragged);
     _builtGO.SetActive(_built);
     _boughtGO.SetActive(_bought);
     _braggedGO.SetActive(_bragged);
     _board.SetActive(_ticket);
     _buildScreen.SetActive(false);
     WM_UI.UpdateUI();
 }
コード例 #10
0
    public void GenerateRumour()
    {
        _activeTown._rumourMod = 1.0f;
        var chance = Random.Range(0, 101);

        _loadedRumourTown = Random.Range(0, _towns.Count);
        _activeTown       = _towns[_loadedRumourTown].GetComponent <TownManager>();
        if (_towns.Count > 1)
        {
            while (_activeTown._name == _townCanvas._townManager._name)
            {
                _loadedRumourTown = Random.Range(0, _towns.Count);
                _activeTown       = _towns[_loadedRumourTown].GetComponent <TownManager>();
            }
        }
        _loadedRumourType = Random.Range(0, _manager._resources.Count);
        if (chance > 75)
        {
            //Increase in price
            _activeTown._rumourMod  = (Random.Range(1.5f, 2.0f));
            _activeTown._rumourType = _loadedRumourType;
            _increase        = true;
            _rumourText.text = "You hear word that " + _manager._resourceNames[_loadedRumourType] + " is scarce in " + _activeTown._name;
        }
        else if (chance > 50)
        {
            //Decrese in price
            _activeTown._rumourMod  = (Random.Range(0.3f, 0.6f));
            _activeTown._rumourType = _loadedRumourType;
            _increase        = false;
            _rumourText.text = "Somebody mentions that sources of " + _manager._resourceNames[_loadedRumourType] + " are abundant in " + _activeTown._name + " at the moment.";
        }
        else
        {
            //You hear nothing
            _rumourText.text       = "You hear nothing but local anecdotes and petty arguments";
            _activeTown._rumourMod = 1.0f;
            _noRumour = true;
        }
        SpawnUI();
        _manager._obols -= _cost;
        WM_UI.UpdateUI();
        _activeTown.GeneratePrices();
        _rumourActive              = true;
        _dayTimer._rumourTimer     = 0;
        _rumourButton.interactable = false;
        _saveGame.Save();
    }
コード例 #11
0
 public void AddResource()
 {
     if (_type > 0)
     {
         _manager._resources[3] -= 10;
         _manager._resources[5] += 1;
     }
     else
     {
         _manager._resources[2] -= 4;
         _manager._resources[3] -= 2;
         _manager._resources[4] += 1;
     }
     CheckResources(_type);
     WM_UI.UpdateUI();
 }
コード例 #12
0
 public void LoadRumour()
 {
     _activeTown = _towns[_loadedRumourTown].GetComponent <TownManager>();
     if (_increase)
     {
         _activeTown._rumourMod  = (Random.Range(1.5f, 2.0f));
         _activeTown._rumourType = _loadedRumourType;
         SpawnUI();
     }
     else
     {
         _activeTown._rumourMod  = (Random.Range(0.3f, 0.6f));
         _activeTown._rumourType = _loadedRumourType;
         SpawnUI();
     }
     WM_UI.UpdateUI();
     _activeTown.GeneratePrices();
     _rumourActive = true;
     _rumourButton.interactable = false;
 }