43 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
44 void SetStates(TArray<FTrafficLightStage> States);
46 UFUNCTION(Category =
"Traffic Controller", BlueprintPure)
50 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
54 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
55 bool AdvanceTimeAndCycleFinished(
float DeltaTime);
57 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
60 UFUNCTION(Category =
"Traffic Controller", BlueprintPure)
61 const TArray<UTrafficLightComponent *> &GetTrafficLights();
63 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
64 void EmptyTrafficLights();
66 UFUNCTION(Category =
"Traffic Controller", BlueprintPure)
67 const FString &GetControllerId()
const;
69 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
70 void SetControllerId(
const FString &Id);
72 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
73 void AddTrafficLight(UTrafficLightComponent *
TrafficLight);
75 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
76 void RemoveTrafficLight(UTrafficLightComponent *
TrafficLight);
78 void AddCarlaActorTrafficLight(
FCarlaActor* CarlaActor);
80 void RemoveCarlaActorTrafficLight(
FCarlaActor* CarlaActor);
82 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
83 bool IsCycleFinished()
const;
85 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
88 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
89 int GetSequence()
const;
91 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
92 void SetSequence(
int InSequence);
94 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
97 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
98 void SetYellowTime(
float NewTime);
100 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
101 void SetRedTime(
float NewTime);
103 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
104 void SetGreenTime(
float NewTime);
106 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
107 float GetGreenTime()
const;
109 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
110 float GetYellowTime()
const;
112 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
113 float GetRedTime()
const;
115 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
116 float GetElapsedTime()
const;
118 UFUNCTION(Category =
"Traffic Controller", BlueprintCallable)
119 void SetElapsedTime(
float InElapsedTime);
129 return CurrentLightState;
133 CurrentLightState = NewState;
142 UPROPERTY(Category =
"Traffic Controller", EditAnywhere)
143 FString ControllerId = "";
145 UPROPERTY(Category = "Traffic Controller", EditAnywhere)
146 int CurrentState = 0;
149 UPROPERTY(Category = "Traffic Controller", EditAnywhere)
151 {10, ETrafficLightState::Green},
152 { 3, ETrafficLightState::Yellow},
153 { 2, ETrafficLightState::Red}
156 UPROPERTY(Category =
"Traffic Controller", EditAnywhere)
157 TArray<UTrafficLightComponent *> TrafficLights;
161 UPROPERTY(Category = "Traffic Controller", VisibleAnywhere)
165 UPROPERTY(Category = "Traffic Controller", EditAnywhere)
169 float ElapsedTime = 0;