// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"//UE核心代码组件
#include "GameFramework/GameModeBase.h"//C++游戏模式基础组件
#include "D3GameMode.generated.h"//反射机制生成的代码
UCLASS(minimalapi)
class AD3GameMode : public AGameModeBase
{
GENERATED_BODY()
public:
AD3GameMode();
};
GameMode.cpp
// Copyright Epic Games, Inc. All Rights Reserved.
#include "D3GameMode.h"
#include "D3Character.h"
#include "UObject/ConstructorHelpers.h"
AD3GameMode::AD3GameMode()
{
// 设置默认pawn类为我们的蓝图角色
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter"));
if (PlayerPawnBPClass.Class != NULL)
{
DefaultPawnClass = PlayerPawnBPClass.Class;
}
}
Character.h
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"//UE核心代码组件
#include "GameFramework/Character.h"//C++角色组件
#include "Logging/LogMacros.h"//日志宏组件
#include "D3Character.generated.h"//反射机制生成的代码
class USpringArmComponent;//弹簧臂组件声明
class UCameraComponent;//摄像机组件声明
class UInputMappingContext;//映射上下文组件声明
class UInputAction;//
struct FInputActionValue;
DECLARE_LOG_CATEGORY_EXTERN(LogTemplateCharacter, Log, All);
UCLASS(conf