暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GetIndexerUnit.cs 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #if VISUAL_SCRIPTING_ENABLED
  2. using Unity.VisualScripting;
  3. namespace UnityEngine.AdaptivePerformance.VisualScripting
  4. {
  5. [UnitShortTitle("Get Indexer Data")]
  6. [UnitSubtitle("Performance and Thermal Actions")]
  7. [UnitCategory("AdaptivePerformance/Scaler")]
  8. public class GetIndexerUnit : Unit
  9. {
  10. [DoNotSerialize]
  11. public ValueOutput performanceAction;
  12. [DoNotSerialize]
  13. public ValueOutput thermalAction;
  14. [DoNotSerialize]
  15. public ValueOutput timeUntilNextAction;
  16. StateAction PerformanceAction;
  17. StateAction ThermalAction;
  18. float TimeUntilNextAction;
  19. protected override void Definition()
  20. {
  21. performanceAction = ValueOutput<StateAction>("Performance Action", (flow) => { UpdateStats(); return PerformanceAction; });
  22. thermalAction = ValueOutput<StateAction>("Thermal Action", (flow) => { UpdateStats(); return ThermalAction; });
  23. timeUntilNextAction = ValueOutput<float>("Time until next Action", (flow) => { UpdateStats(); return TimeUntilNextAction; });
  24. }
  25. void UpdateStats()
  26. {
  27. if (Application.isPlaying && Holder.Instance != null)
  28. {
  29. var indexer = Holder.Instance.Indexer;
  30. PerformanceAction = indexer.PerformanceAction;
  31. ThermalAction = indexer.ThermalAction;
  32. TimeUntilNextAction = indexer.TimeUntilNextAction;
  33. }
  34. }
  35. }
  36. }
  37. #endif