Example #1
0
 public AsyncValue(AsyncUpdater updater, T value, float updateTimeDeltaSeconds, Func <T> updateFunc)
 {
     this.updater = updater;
     this.updateTimeDeltaSeconds = updateTimeDeltaSeconds;
     this.updateFunc             = updateFunc;
     this.value        = value;
     this.updateHandle = updater.Register(() => newValue = updateFunc());
 }
        public SamsungGameSDKAdaptivePerformanceSubsystem()
        {
            m_Api          = new NativeApi(OnPerformanceWarning, OnPerformanceLevelTimeout);
            m_AsyncUpdater = new AsyncUpdater();
            m_SkinTemp     = new AsyncValue <int>(m_AsyncUpdater, -1, 2.7f, () => m_Api.GetSkinTempLevel());
            m_PSTLevel     = new AsyncValue <int>(m_AsyncUpdater, -1, 3.3f, () => m_Api.GetPSTLevel());
            m_GPUTime      = new AsyncValue <double>(m_AsyncUpdater, -1.0, 0.0f, () => m_Api.GetGpuFrameTime());

            Capabilities = Feature.CpuPerformanceLevel | Feature.GpuPerformanceLevel | Feature.PerformanceLevelControl | Feature.TemperatureLevel | Feature.WarningLevel | Feature.GpuFrameTime;

            m_MainTemperature = m_SkinTemp;

            m_AsyncUpdater.Start();
        }