using System;
namespace UnityEngine.AdaptivePerformance
{
///
/// You can subscribe to the thermal event delegate which sends the when the thermal state changes.
///
///
public delegate void ThermalEventHandler(ThermalMetrics thermalMetrics);
///
/// ThermalMetrics stores the thermal state as , , and .
///
public struct ThermalMetrics
{
///
/// Current thermal warning level.
///
public WarningLevel WarningLevel { get; set; }
///
/// Current normalized temperature level in the range of [0, 1].
/// A value of 0 means standard operation temperature and that the device is not in a throttling state.
/// A value of 1 means that the device has reached maximum temperature and is either going into or is already in throttling state.
///
/// Value in the range [0, 1].
public float TemperatureLevel { get; set; }
///
/// Current normalized temperature trend in the range of [-1, 1].
/// A value of 1 describes a rapid increase in temperature.
/// A value of 0 describes a constant temperature.
/// A value of -1 describes a rapid decrease in temperature.
/// **Note:** It takes at least 10s until the temperature trend can start reflecting any changes.
///
/// Value in the range [-1, 1].
public float TemperatureTrend { get; set; }
}
///
/// Use the thermal status interface to receive thermal status events and thermal metrics of the device.
///
public interface IThermalStatus
{
///
/// The latest thermal metrics available.
///
/// The latest thermal metrics
ThermalMetrics ThermalMetrics { get; }
///
/// Subscribe to thermal events which Adaptive Performance sends when the thermal state of the device changes.
///
event ThermalEventHandler ThermalEvent;
}
///
/// Warning levels are used in the and describe the thermal status of the device. There are three possible statuses.
///
public enum WarningLevel
{
///
/// No warning is the normal warning level during standard thermal state.
///
NoWarning,
///
/// If throttling is imminent, the application should perform adjustments to avoid thermal throttling.
///
ThrottlingImminent,
///
/// If the application is in the throttling state, it should make adjustments to go back to normal temperature levels.
///
Throttling,
}
}