Vyktori b31dad8ca5 *WIP* Robot Base Class, LuckyWorldSubsystem, LuckyRobotMovementComponent
- Robot Base Class -> Handles inputs, has Mujoco settings, creates proper movement component
- LuckyWorldSubsystem -> Has Get and Ready functions for many Robot values/updates
- LuckyRobotMovementComponent -> Base component for robot movement. Can read any value or input from the owning robot. Can be reused on similar robots or custom components can be created if needed.
2025-04-17 00:00:14 -04:00

75 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "Subsystems/LuckyWorldSubsystem.h"
#include "Gameplay/Robot/LuckyRobotPawnBase.h"
void ULuckyWorldSubsystem::CheckSimulationReady()
{
if (!bSimulationReady)
{
bool bReady = true;
if (!GetLuckyRobot())
{
UE_LOG(LogTemp, Log, TEXT("CheckSimulationReady -> LuckyRobot IS NOT READY"));
bReady = false;
}
// add any other false checks here if they are not ready
if (bReady)
{
bSimulationReady = true;
if (LuckyRobotSimulationReady.IsBound())
{
LuckyRobotSimulationReady.Broadcast();
}
}
}
}
void ULuckyWorldSubsystem::RegisterLuckyRobot(ALuckyRobotPawnBase* InLuckyRobot)
{
if (InLuckyRobot)
{
LuckyRobotPawn = InLuckyRobot;
if (LuckyRobotReady.IsBound())
{
LuckyRobotReady.Broadcast(GetLuckyRobot());
//LuckyRobotReady.Clear();
}
CheckSimulationReady();
}
}
void ULuckyWorldSubsystem::UpdateCurrentTaskIndex(const float InCurrentTaskIndex)
{
Robot_CurrentTaskIndex = InCurrentTaskIndex;
if (CurrentTaskIndexChanged.IsBound())
{
CurrentTaskIndexChanged.Broadcast(Robot_CurrentTaskIndex);
}
}
void ULuckyWorldSubsystem::UpdateTargetSpeed(const float InTargetSpeed)
{
Robot_TargetSpeed = InTargetSpeed;
if (TargetSpeedChanged.IsBound())
{
TargetSpeedChanged.Broadcast(Robot_TargetSpeed);
}
}
void ULuckyWorldSubsystem::UpdateTorqueLimiter(const float InTorqueLimiter)
{
Robot_TorqueLimiter = InTorqueLimiter;
if (TorqueLimiterChanged.IsBound())
{
TorqueLimiterChanged.Broadcast(Robot_TorqueLimiter);
}
}