Пример #1
0
    private void ActivateDrawingTool()
    {
        if (drawingTool != null)
        {
            drawingTool.OnDraw += OnDraw;
            drawingTool.Activate();

            if (drawingTool.Erasing)
            {
                pulsatingCell.SetColor(Color.red);
            }
            else
            {
                pulsatingCell.SetColor(Color.white);
            }
        }
    }
Пример #2
0
    private void OnTypologyGroupChanged(bool isOn)
    {
        // deaktivate erase mode if usere click on typology of on;
        if (selectedTool != null)
        {
            if (selectedTool.Erasing == true)
            {
                selectedTool.OnCancel -= OnCancelBrushTool;
                var tools = toolsGroup.GetComponentsInChildren <Toggle>();
                // if erase true, toolsGroup should be always only 1 item
                tools[0].isOn = false;
                // activate last used tool before erasing
                if (lastSelectedTool != null)
                {
                    selectedTool = lastSelectedTool;
                    selectedTool.Activate();
                    selectedTool.Erasing = false;
                    planner.SetDrawingTool(selectedTool);
                }
            }
        }

        for (int i = 0; i < toggles.Count; ++i)
        {
            if (!planner)
            {
                break;
            }

            if (!toggles[i].IsActive())
            {
                continue;
            }

            var toggle = toggles[i].GetComponentInChildren <Toggle>();
            if (toggle.isOn)
            {
                planner.SetTypology(i);
                return;
            }
        }
    }