37 lines
		
	
	
		
			899 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			899 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using UnrealSharp.Engine;
 | |
| using UnrealSharp.Attributes;
 | |
| using UnrealSharp.BusyRabbit;
 | |
| using UnrealSharp.UMG;
 | |
| 
 | |
| namespace UI.Level.StateBar;
 | |
| 
 | |
| [UClass]
 | |
| public class UBusyWidgetSatietyBar : UPW_MinimalWidget
 | |
| {
 | |
|     protected UProgressBar? SatietyBar { get { return GetWidget("SatietyBar") as UProgressBar; } }
 | |
| 
 | |
|     protected float CurrSatiety;
 | |
|     protected float MaxSatiety;
 | |
|     public void SetSatietyConfig(float CurrSatiety, float MaxSatiety)
 | |
|     {
 | |
|         this.MaxSatiety = MaxSatiety;
 | |
|         this.CurrSatiety = CurrSatiety;
 | |
|         RefreshDisplay();
 | |
|     }
 | |
| 
 | |
|     public void OnSatietyChanged(float CurSatiety)
 | |
|     {
 | |
|         this.CurrSatiety = CurSatiety;
 | |
|         RefreshDisplay();
 | |
|     }
 | |
| 
 | |
|     public void RefreshDisplay()
 | |
|     {
 | |
|         float Percent = MaxSatiety > 0 ? CurrSatiety / MaxSatiety : 0;
 | |
|         if (SatietyBar != null)
 | |
|         {
 | |
|             SatietyBar.Percent = Percent;
 | |
|         }
 | |
|     }
 | |
| }
 |