Project02/ProjectFish/Source/ProjectFish/ProjectFishGameMode.cpp

46 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ProjectFishGameMode.h"
#include "ProjectFishPlayerController.h"
#include "ProjectFishCharacter.h"
#include "Settings/GameConfigSettings.h"
#include "UObject/ConstructorHelpers.h"
AProjectFishGameMode::AProjectFishGameMode()
{
// use our custom PlayerController class
PlayerControllerClass = AProjectFishPlayerController::StaticClass();
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/TopDown/Blueprints/BP_TopDownCharacter"));
if (PlayerPawnBPClass.Class != nullptr)
{
DefaultPawnClass = PlayerPawnBPClass.Class;
}
// set default controller to our Blueprinted controller
static ConstructorHelpers::FClassFinder<APlayerController> PlayerControllerBPClass(TEXT("/Game/TopDown/Blueprints/BP_TopDownPlayerController"));
if(PlayerControllerBPClass.Class != NULL)
{
PlayerControllerClass = PlayerControllerBPClass.Class;
}
}
void AProjectFishGameMode::BeginPlay()
{
Super::BeginPlay();
const UGameConfigSettings* ConfigSettings = GetDefault<UGameConfigSettings>();
FTimerHandle FishingTimerHandle;
GetWorld()->GetTimerManager().SetTimer(FishingTimerHandle, [this]()
{
this->bBattleIsBegin = true;
}, ConfigSettings->BattaleWatingTime, false);
}
bool AProjectFishGameMode::GetBattleIsBegin() const
{
return bBattleIsBegin;
}