Пример #1
0
    private void Command()
    {
        _field.text += _input.text + "\n";

        if (_input.text.Contains(_save))
        {
            string t_saveInput = _input.text.Replace(_save, "");
            t_saveInput = t_saveInput.TrimEnd();
            if (t_saveInput == "")
            {
                _field.text += new NullReferenceException() + "\n";
                return;
            }

            _dataManager.GenerateSave(t_saveInput.ToUpper());
            _input.text  = "";
            _field.text += "Succesfull. \n";
        }
        else if (_input.text == _godmode)
        {
            ResourceManager t_resourceManager = ResourceManager.Instance;
            _field.text           += "Succesfully initiated godmode. \n";
            t_resourceManager.Wood = 100000;
            t_resourceManager.Rock = 100000;

            SceneManager   t_sceneManager   = SceneManager.Instance;
            DataReferences t_dataReferences = t_sceneManager.DataReferences;

            ResourceInfo t_resourceInfo = t_dataReferences.FindElement <ResourceInfo>("RESOURCE_DATA");
            t_resourceInfo.Wood = 100000;
            t_resourceInfo.Rock = 100000;

            t_resourceInfo.Save();
        }
        else if (_input.text == _exit)
        {
            Application.Quit();
        }
        else if (_input.text == _pause)
        {
            UIManager t_uiManager = UIManager.Instance;

            t_uiManager.SetTimeScale(0);
            t_uiManager.ClosePrompt();
            t_uiManager.LockCursor(true);
            t_uiManager.CommandsOpened = !t_uiManager.CommandsOpened;
        }
        else if (_input.text == _unpause)
        {
            UIManager t_uiManager = UIManager.Instance;

            t_uiManager.SetTimeScale(1);
            t_uiManager.ClosePrompt();
            t_uiManager.LockCursor(true);
            t_uiManager.CommandsOpened = !t_uiManager.CommandsOpened;
        }
        else
        {
            _field.text += new InvalidOperationException() + "\n";
        };
    }
Пример #2
0
 public void AddWood(int p_input)
 {
     _wood += p_input;
     _resourceInfo.Wood = _wood;
     _resourceInfo.Save();
 }