Пример #1
0
    void Start()
    {
        if (!background || !knob || !timecode)
        {
            Debug.LogError("Knob, Timecode or Background are missing");
            return;
        }
        knobScale = knob.transform.localScale;

        ui = Interactivity.instance;
        if (!ui)
        {
            Debug.LogError("__Interactivity is missing from the scene");
            return;
        }

        if (!ui.allowScrubbing)
        {
            return;
        }

        Fadein();
        Fadeout(duration, introductoryDelay);

        ui.OnInputDown += (pos) =>
        {
            if (!ui.IsScreenPointInsideSrubber(pos))
            {
                return;
            }

            Fadein();
            KnobScale(1.0f, 1.0f + knobReactiveScale, 0.3f);

            visible = true;
        };

        ui.OnInputUp += (pos) =>
        {
            if (!ui.IsScreenPointInsideSrubber(pos) && !visible)
            {
                return;
            }

            Fadeout(duration, delay);
            KnobScale(1.0f + knobReactiveScale, 1.0f, 0.5f);

            visible = false;
        };
    }