Ejemplo n.º 1
0
    public void Update()
    {
        if (controls == null || controls.Count == 0)
        {
            setSelectedIndex(0);
            return;
        }

        if (isMouseDown)
        {
            var selectedControl = findClosestItemToCenter();
            if (selectedControl != null)
            {
                setSelectedIndex(controls.IndexOf(selectedControl));
                lastSelected = selectedIndex;
            }
        }

        var temp = Mathf.Max(0, selectedIndex);

        temp = Mathf.Min(controls.Count - 1, temp);
        setSelectedIndex(temp);

        if (Application.isPlaying)
        {
            updateSlides();
        }
        else
        {
            layoutSlidesForEditor();
        }
    }