using { /Fortnite.com/Devices } using { /UnrealEngine.com/Temporary/Synthetics } using { /UnrealEngine.com/Engine/Classes/Engine/World } using { /UnrealEngine.com/Engine/Classes/GameFramework/PlayerController } # Define our team state. # Think of this as your "Elimination Count" or "Score." var IsTeamA_Winning: bool = true # This function is like the "Storm Timer" ticking. # It checks who is winning and updates the UI color. Update_Team_UI := func(): # We need to find the widget in the scene. # In a real build, you'd reference this via a Device or Event. # For this demo, we assume we have a reference to the Widget. widget := World.Get_Player_Controller(0).Get_Widget("W_TeamScore") if (widget != None): # Get the specific shape component inside the widget. # This is like finding the "body" of the player. shape := widget.Get_Component("RectangleShape") if (shape != None): # Get the Material Instance we created. # This is like equipping the skin. material := shape.Get_Material(0) if (material != None): # HERE IS THE MAGIC. # We are changing the "Base Color" parameter on the Instance. # If IsTeamA_Winning is true, it turns Green. # If false, it turns Red. if (IsTeamA_Winning): material.Set_Vector_Parameter("Base Color", Vector3(0.0, 1.0, 0.0)) # Green else: material.Set_Vector_Parameter("Base Color", Vector3(1.0, 0.0, 0.0)) # Red # This is our "Game Loop" or "Tick." # It runs every frame to keep the UI updated. Game_Loop := func(): Update_Team_UI()