diff --git a/Content/NPC_BP.uasset b/Content/NPC_BP.uasset index 8a559b0..a20b06f 100644 Binary files a/Content/NPC_BP.uasset and b/Content/NPC_BP.uasset differ diff --git a/Source/SevenStars/NPC.cpp b/Source/SevenStars/NPC.cpp index 632ac9b..25a253a 100644 --- a/Source/SevenStars/NPC.cpp +++ b/Source/SevenStars/NPC.cpp @@ -8,6 +8,20 @@ ANPC::ANPC() PrimaryActorTick.bCanEverTick = true; } +bool ANPC::CustomRandomBool() +{ + bool bool1 = FMath::RandBool(); + if (bool1 == saveBool1 && bool1 == saveBool2) { + saveBool2 = saveBool1; + saveBool1 = !bool1; + return !bool1; + } + saveBool2 = saveBool1; + saveBool1 = bool1; + return bool1; +} + + FString ANPC::GetQuestionLeft() { if (NPC_Name == "Zyxel") { diff --git a/Source/SevenStars/NPC.h b/Source/SevenStars/NPC.h index a0c2c7b..7ffad00 100644 --- a/Source/SevenStars/NPC.h +++ b/Source/SevenStars/NPC.h @@ -16,6 +16,12 @@ public: virtual void BeginPlay() override; virtual void Tick(float DeltaTime) override; + bool saveBool1 = true; + bool saveBool2 = true; + UFUNCTION(BlueprintCallable) + bool CustomRandomBool(); + + UFUNCTION(BlueprintCallable) FString GetQuestionLeft(); UFUNCTION(BlueprintCallable)