Beispiel #1
0
    private void Awake()
    {
        Assert.IsTrue(getPerSecond > 0, "getPerSecond must be positive");
        Assert.IsTrue(setPerSecond > 0, "setPerSecond must be positive");

        // Seconds between calls is more useful during runtime, but calls per
        // second is easier to set.
        minimumGetPeriod = 1 / getPerSecond;
        minimumSetPeriod = 1 / setPerSecond;

        SystemVolumePlugin.LogDelegate logDelegate = Log;

        SystemVolumePlugin.SetLoggingCallback(Marshal.GetFunctionPointerForDelegate(logDelegate));

        var ret = SystemVolumePlugin.InitializeVolume();

        if (ret != 0)
        {
            Debug.LogErrorFormat("Volume initialization failed with code {0}", ret);
        }

        if (linearMapping == null)
        {
            linearMapping = GetComponent <LinearMapping>();
        }

        var initialVolume = Volume;

        linearMapping.value = initialVolume;
        desiredVolume       = initialVolume;
        Debug.LogFormat("Starting volume is {0:f3}", initialVolume);
    }
    public void Start()
    {
        AddListener();
        StartCoroutine(RegisIOT());
        SystemVolumePlugin.InitializeVolume();

        InvokeRepeating("UpdateVolume", 3f, 1f);
    }