98 lines
3.5 KiB
C++
98 lines
3.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Gameplay/Robot/Data/RobotSettings.h"
|
|
#include "Subsystems/WorldSubsystem.h"
|
|
#include "LuckyWorldSubsystem.generated.h"
|
|
|
|
|
|
class UNavigationPath;
|
|
class AMujocoVolumeActor;
|
|
class ALuckyRobotPawnBase;
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLuckyRobotSimulationReadyDelegate);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLuckyRobotPawnReadyDelegate, ALuckyRobotPawnBase*, LuckyRobot);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLuckyRobotCurrentTaskChangedDelegate, const int32, NewTaskIndex);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLuckyRobotTargetSpeedChangedDelegate, const float, NewTargetSpeed);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLuckyRobotTorqueLimiterChangedDelegate, const float, NewTorqueLimiter);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLuckyRobotNavPathChangedDelegate, const FRobotNavPath&, NewRobotNavPath);
|
|
|
|
UCLASS()
|
|
class LUCKYWORLDV2_API ULuckyWorldSubsystem : public UWorldSubsystem
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
// GENERAL
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotSimulationReadyDelegate LuckyRobotSimulationReady;
|
|
|
|
void CheckSimulationReady();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Lucky World Subsystem")
|
|
bool IsSimulationReady() const { return bSimulationReady; }
|
|
|
|
// LUCKY ROBOT
|
|
void RegisterLuckyRobot(ALuckyRobotPawnBase* InLuckyRobot);
|
|
|
|
UFUNCTION(BlueprintPure, Category = "Lucky World Subsystem")
|
|
ALuckyRobotPawnBase* GetLuckyRobot() const { return LuckyRobotPawn.Get(); }
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotPawnReadyDelegate LuckyRobotReady;
|
|
|
|
// CURRENT TASK
|
|
void UpdateCurrentTaskIndex(const float InCurrentTaskIndex = -1);
|
|
|
|
UFUNCTION(BlueprintPure, Category = "Lucky World Subsystem")
|
|
float GetCurrentTaskIndex() const { return Robot_CurrentTaskIndex; }
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotCurrentTaskChangedDelegate CurrentTaskIndexChanged;
|
|
|
|
// TARGET SPEED
|
|
void UpdateTargetSpeed(const float InTargetSpeed = 0.f);
|
|
|
|
UFUNCTION(BlueprintPure, Category = "Lucky World Subsystem")
|
|
float GetTargetSpeed() const { return Robot_TargetSpeed; }
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotTargetSpeedChangedDelegate TargetSpeedChanged;
|
|
|
|
// TORQUE LIMITER
|
|
void UpdateTorqueLimiter(const float InTorqueLimiter = 0.f);
|
|
|
|
UFUNCTION(BlueprintPure, Category = "Lucky World Subsystem")
|
|
float GetTorqueLimiter() const { return Robot_TorqueLimiter; }
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotTorqueLimiterChangedDelegate TorqueLimiterChanged;
|
|
|
|
// ROBOT NAV PATH
|
|
UFUNCTION(BlueprintCallable, Category = "Lucky World Subsystem")
|
|
void UpdateRobotNavPath(const FRobotNavPath& InRobotNavPath);
|
|
|
|
UFUNCTION(BlueprintPure, Category = "Lucky World Subsystem")
|
|
FRobotNavPath GetRobotNavPath() const { return RobotNavPath; }
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Lucky World Subsystem")
|
|
FLuckyRobotNavPathChangedDelegate RobotNavPathChanged;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Lucky World Subsystem")
|
|
FRobotNavPath GenerateRobotNavPath_Navigation(UNavigationPath* InNavPath);
|
|
|
|
protected:
|
|
TWeakObjectPtr<ALuckyRobotPawnBase> LuckyRobotPawn;
|
|
TWeakObjectPtr<AMujocoVolumeActor> MujocoVolumeActor;
|
|
|
|
UPROPERTY()
|
|
FRobotNavPath RobotNavPath = FRobotNavPath();
|
|
|
|
float Robot_TargetSpeed = 0.f;
|
|
float Robot_TorqueLimiter = 0.85f;
|
|
int32 Robot_CurrentTaskIndex = -1;
|
|
|
|
bool bSimulationReady = false;
|
|
};
|