36
									
								
								Script/ManagedBusyRabbit/UI/Level/StateBar/BusySatietyBar.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Script/ManagedBusyRabbit/UI/Level/StateBar/BusySatietyBar.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| 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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user