Ejemplo n.º 1
0
    void Start()
    {
        InitializeTool(new Tool_MapSettings());
        InitializeTool(new Tool_MapSize());
        InitializeTool(new Tool_TilePlace());
        InitializeTool(new Tool_TileRemove());
        InitializeTool(new Tool_TerrainEdit());

        _currentTool = _tools[0];
        _currentTool.OnSelected();
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        GUI.Box(new Rect(0, 0, 340, Screen.height), "");

        int i = 0;

        //draw button for every tool
        foreach (var tool in _tools)
        {
            if (GUI.Button(new Rect(5 + (i % 3) * 105, 22 * (i++ / 3) + 45, 100, 20), tool.ToolName))
            {
                _currentTool.OnDeselected();
                _currentTool = tool;
                _currentTool.OnSelected();
            }
        }

        //draw gui of the current tool
        _currentTool.UpdateGUI(new Rect(5, 22 * (i++) + 45, 330, Screen.height));
    }