diff --git a/Content/Blueprint/Core/BP_selectorPoi.uasset b/Content/Blueprint/Core/BP_selectorPoi.uasset index a44f1bbf..d7d18750 100644 Binary files a/Content/Blueprint/Core/BP_selectorPoi.uasset and b/Content/Blueprint/Core/BP_selectorPoi.uasset differ diff --git a/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset b/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset index 33572e33..7006f570 100644 Binary files a/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset and b/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset differ diff --git a/Content/Blueprint/component/BPC_Capture.uasset b/Content/Blueprint/component/BPC_Capture.uasset index e4a7825a..acfe67ff 100644 Binary files a/Content/Blueprint/component/BPC_Capture.uasset and b/Content/Blueprint/component/BPC_Capture.uasset differ diff --git a/Content/Blueprint/component/BPC_NaviPoint.uasset b/Content/Blueprint/component/BPC_NaviPoint.uasset index 5ca33e5f..e5b4519f 100644 Binary files a/Content/Blueprint/component/BPC_NaviPoint.uasset and b/Content/Blueprint/component/BPC_NaviPoint.uasset differ diff --git a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset index 9b89357e..656627df 100644 Binary files a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset and b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset differ diff --git a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset index aaffcf85..349acd61 100644 Binary files a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset and b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset differ diff --git a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset index b15591f8..70ded875 100644 Binary files a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset and b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset differ diff --git a/Content/GameBP/UI/WB_GameWidget.uasset b/Content/GameBP/UI/WB_GameWidget.uasset index 20d95c01..d22a58cc 100644 Binary files a/Content/GameBP/UI/WB_GameWidget.uasset and b/Content/GameBP/UI/WB_GameWidget.uasset differ diff --git a/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset b/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset index dfec9bc9..0aeb84ce 100644 Binary files a/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset and b/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset index 0e466912..f076a629 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset index e1f4b826..0fd6e25e 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset index 28ee87d7..c622d309 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset differ diff --git a/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset b/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset index dd66ad7a..b680777e 100644 Binary files a/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset and b/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset differ diff --git a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp index 10a55efd..c839810d 100644 --- a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp +++ b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp @@ -11,6 +11,7 @@ #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h" #include "VaRestSubsystem.h" #include "Subsystems/SubsystemBlueprintLibrary.h" +#include "Gameplay/TargetSelector.h" void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue) { @@ -46,22 +47,22 @@ void ULuckyRobotsGameInstance::SwitchGamePaused() void ULuckyRobotsGameInstance::ClearTaskList() { - TaskList.Empty(); + CurrentCaptureSettingsData.TaskList.Empty(); } void ULuckyRobotsGameInstance::AddTask(const FGoalsTaskData& TaskData) { - TaskList.Add(TaskData); + CurrentCaptureSettingsData.TaskList.Add(TaskData); } void ULuckyRobotsGameInstance::RemoveTask(const FGoalsTaskData& TaskData) { - TaskList.Remove(TaskData); + CurrentCaptureSettingsData.TaskList.Remove(TaskData); } void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType) { - for (const FGoalsTaskData& Task : TaskList) + for (FGoalsTaskData Task : CurrentCaptureSettingsData.TaskList) { if (Task.GoalType == GoalType) { @@ -73,18 +74,18 @@ void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType) int32 ULuckyRobotsGameInstance::GetTaskNum() const { - return TaskList.Num(); + return CurrentCaptureSettingsData.TaskList.Num(); } void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskData) { - if (TaskList.IsValidIndex(Index)) + if (CurrentCaptureSettingsData.TaskList.IsValidIndex(Index)) { - TaskList[Index] = TaskData; + CurrentCaptureSettingsData.TaskList[Index] = TaskData; } else { - while (TaskList.Num() < Index) + while (CurrentCaptureSettingsData.TaskList.Num() < Index) { FGoalsTaskData TempTaskData; AddTask(TempTaskData); @@ -95,9 +96,9 @@ void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskDa bool ULuckyRobotsGameInstance::GetTask(int32 Index, FGoalsTaskData& OutTaskData) const { - if (TaskList.IsValidIndex(Index)) + if (CurrentCaptureSettingsData.TaskList.IsValidIndex(Index)) { - OutTaskData = TaskList[Index]; + OutTaskData = CurrentCaptureSettingsData.TaskList[Index]; return true; } return false; @@ -106,19 +107,19 @@ bool ULuckyRobotsGameInstance::GetTask(int32 Index, FGoalsTaskData& OutTaskData) void ULuckyRobotsGameInstance::ReSetTaskList() { TArray TempTaskList; - for (FGoalsTaskData& Task : TaskList) + for (FGoalsTaskData& Task : CurrentCaptureSettingsData.TaskList) { Task.bIsStart = false; Task.bIsComplete = false; Task.bActive = false; TempTaskList.Add(Task); } - TaskList = TempTaskList; + CurrentCaptureSettingsData.TaskList = TempTaskList; } TArray ULuckyRobotsGameInstance::GetTaskList() const { - return TaskList; + return CurrentCaptureSettingsData.TaskList; } void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool bIsClear) @@ -379,6 +380,38 @@ FParsedData ULuckyRobotsGameInstance::DoJsonParse(const FString& JsonString) return ParsedData; } +void ULuckyRobotsGameInstance::UpdateTargetSelector() +{ + TArray AllTargetSelector; + UGameplayStatics::GetAllActorsOfClass(this, ATargetSelector::StaticClass(), AllTargetSelector); + for (auto TargetSelector : AllTargetSelector) + { + if (TargetSelector) + { + TargetSelector->Destroy(); + } + } + + TArray GoalsTaskList = GetTaskList(); + for (int i = 0; i < GoalsTaskList.Num() ; ++i) + { + if (GoalsTaskList[i].GoalType == EGoalType::NavigateSimpleEnvironments) + { + if (i == 0) + { + TargetPosition = GoalsTaskList[i].TargetLocation; + } + ATargetSelector* TargetSelector = GetWorld()->SpawnActorDeferred(TargetSelectorClass, GoalsTaskList[i].TargetLocation, nullptr, nullptr, + ESpawnActorCollisionHandlingMethod::AlwaysSpawn); + if (TargetSelector) + { + TargetSelector->FinishSpawning(GoalsTaskList[i].TargetLocation); + TargetSelector->bIsTracing = false; + } + } + } +} + void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName) { CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName); diff --git a/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp b/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp new file mode 100644 index 00000000..ed36ad54 --- /dev/null +++ b/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Gameplay/TargetSelector.h" + +// Sets default values +ATargetSelector::ATargetSelector() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void ATargetSelector::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void ATargetSelector::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h index 67cba8f6..68ad921a 100644 --- a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h +++ b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h @@ -42,6 +42,9 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") UDataTable* BathroomDataTable; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") + TSubclassOf TargetSelectorClass; + public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") TArray AlphabetForRandomList; @@ -106,8 +109,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Random Mesh") bool bIsRandomPannel; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Random Mesh") - bool bIsRandomRobotPosition; public: UPROPERTY(EditAnywhere, BlueprintReadWrite) @@ -119,9 +120,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite) EQualityEnum CurrentSelectQuality = EQualityEnum::Epic; - UPROPERTY(EditAnywhere, BlueprintReadWrite) - TArray TaskList; - UPROPERTY(EditAnywhere, BlueprintReadWrite) FGoalsTaskData TempTask; @@ -206,6 +204,9 @@ public: UFUNCTION(BlueprintCallable) FParsedData DoJsonParse(const FString& JsonString); + UFUNCTION(BlueprintCallable) + void UpdateTargetSelector(); + public: UFUNCTION(BlueprintCallable) void SetCurrentFolderName(const FString& FolderName); diff --git a/Source/Luckyrobots/Public/Gameplay/TargetSelector.h b/Source/Luckyrobots/Public/Gameplay/TargetSelector.h new file mode 100644 index 00000000..29fbfdf8 --- /dev/null +++ b/Source/Luckyrobots/Public/Gameplay/TargetSelector.h @@ -0,0 +1,29 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "TargetSelector.generated.h" + +UCLASS() +class LUCKYROBOTS_API ATargetSelector : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + ATargetSelector(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsTracing = true; +}; diff --git a/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h b/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h index cfe802ae..86f8dd01 100644 --- a/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h +++ b/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" +#include "SharedDef.h" #include "CaptureSettingsUserWidget.generated.h" /** @@ -14,4 +15,11 @@ class LUCKYROBOTS_API UCaptureSettingsUserWidget : public UUserWidget { GENERATED_BODY() +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsOpen; + +public: + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) + void BPRefreshTaskList(); };