LuckyRobotsUnreal/Source/Luckyrobots/Private/LuckyRobotsGameMode.cpp

41 lines
1.1 KiB
C++
Raw Normal View History

2025-03-30 11:46:50 +08:00
// Fill out your copyright notice in the Description page of Project Settings.
#include "LuckyRobotsGameMode.h"
#include "LuckyRobotsGameInstance.h"
#include "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);
}
UClass* ALuckyRobotsGameMode::GetDefaultPawnClassForController_Implementation(AController* InController)
{
UClass* RobotClass = Super::GetDefaultPawnClassForController_Implementation(InController);
ERobotsName CurrentRobot = ERobotsName::None;
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
if (LuckyRobotsGameInstance)
{
CurrentRobot = LuckyRobotsGameInstance->CurrentSelectRobot;
}
if (CurrentRobot != ERobotsName::None)
{
TArray<FRobotData> ActiveRobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
for (auto ActiveRobotData : ActiveRobotDataList)
{
if (ActiveRobotData.Name == CurrentRobot)
{
RobotClass = ActiveRobotData.RobotClass;
break;
}
}
}
return RobotClass;
2025-04-01 11:04:11 +08:00
}