Add control variable

This commit is contained in:
Blyron 2024-07-08 11:34:40 +02:00 committed by Blyron
parent 8ba08e1f7e
commit cf3cef936b
3 changed files with 23 additions and 2 deletions

View File

@ -1593,6 +1593,12 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
EActorAttributeType::String,
GetAge(Parameters.Age)});
Definition.Attributes.Emplace(FActorAttribute{
TEXT("can_use_wheel_chair"),
EActorAttributeType::Bool,
Parameters.bCanUseWheelChair ? TEXT("true") : TEXT("false") });
if (Parameters.Speed.Num() > 0)
{
FActorVariation Speed;
@ -1606,6 +1612,8 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
Definition.Variations.Emplace(Speed);
}
bool bCanUseWheelChair = Parameters.bCanUseWheelChair;
FActorVariation IsInvincible;
IsInvincible.Id = TEXT("is_invincible");
IsInvincible.Type = EActorAttributeType::Bool;
@ -1616,8 +1624,15 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
FActorVariation WheelChairVariation;
WheelChairVariation.Id = TEXT("use_wheelchair");
WheelChairVariation.Type = EActorAttributeType::Bool;
WheelChairVariation.RecommendedValues = { TEXT("true"), TEXT("false") };
WheelChairVariation.bRestrictToRecommended = false;
if(bCanUseWheelChair)
{
WheelChairVariation.RecommendedValues = { TEXT("true"), TEXT("false") };
}
else
{
WheelChairVariation.RecommendedValues = { TEXT("false") };
}
WheelChairVariation.bRestrictToRecommended = true;
Definition.Variations.Emplace(WheelChairVariation);
Success = CheckActorDefinition(Definition);

View File

@ -55,4 +55,7 @@ struct CARLA_API FPedestrianParameters
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Generation = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bCanUseWheelChair = false;
};

View File

@ -24,6 +24,9 @@ public:
UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere)
float AfterLifeSpan = 10.0f;
UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere)
bool bUsesWheelChair = false;
UFUNCTION(BlueprintCallable)
void StartDeathLifeSpan()
{