2025-03-30 11:46:50 +08:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
2025-04-07 10:28:47 +08:00
|
|
|
#include "GameModes/LuckyRobotsGameMode.h"
|
|
|
|
#include "Core/LuckyRobotsGameInstance.h"
|
|
|
|
#include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
|
2025-03-30 11:46:50 +08:00
|
|
|
|
2025-04-01 11:04:11 +08:00
|
|
|
void ALuckyRobotsGameMode::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
|
|
|
ULuckyRobotsFunctionLibrary::UpdateQualitySettings(this);
|
|
|
|
}
|
|
|
|
|
2025-03-31 14:59:07 +08:00
|
|
|
UClass* ALuckyRobotsGameMode::GetDefaultPawnClassForController_Implementation(AController* InController)
|
|
|
|
{
|
|
|
|
UClass* RobotClass = Super::GetDefaultPawnClassForController_Implementation(InController);
|
|
|
|
|
|
|
|
ERobotsName CurrentRobot = ERobotsName::None;
|
2025-04-07 11:32:45 +08:00
|
|
|
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
2025-03-31 14:59:07 +08:00
|
|
|
{
|
2025-04-07 11:32:45 +08:00
|
|
|
CurrentRobot = GameInstance->CurrentSelectRobot;
|
2025-03-31 14:59:07 +08:00
|
|
|
}
|
|
|
|
if (CurrentRobot != ERobotsName::None)
|
|
|
|
{
|
|
|
|
TArray<FRobotData> ActiveRobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
|
2025-04-07 11:32:45 +08:00
|
|
|
for (const FRobotData& RobotData : ActiveRobotDataList)
|
2025-03-31 14:59:07 +08:00
|
|
|
{
|
2025-04-07 11:32:45 +08:00
|
|
|
if (RobotData.Name == CurrentRobot)
|
2025-03-31 14:59:07 +08:00
|
|
|
{
|
2025-04-07 11:32:45 +08:00
|
|
|
RobotClass = RobotData.RobotClass;
|
2025-03-31 14:59:07 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return RobotClass;
|
2025-04-01 11:04:11 +08:00
|
|
|
}
|