feat: add core gameplay classes and blueprints
- Add ExoGameMode class - Add ExoCharacterBase class - Add ExoPlayerController with basic movement and camera controls - Add blueprints for ExoPlayerController and ExoGameMode
This commit is contained in:
parent
1220a82663
commit
594689b82b
33
Config/DefaultEditorPerProjectUserSettings.ini
Normal file
33
Config/DefaultEditorPerProjectUserSettings.ini
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
[/Script/UnrealEd.EditorStyleSettings]
|
||||||
|
bEnableUserEditorLayoutManagement=True
|
||||||
|
ColorVisionDeficiencyPreviewType=NormalVision
|
||||||
|
ColorVisionDeficiencySeverity=3
|
||||||
|
bColorVisionDeficiencyCorrection=False
|
||||||
|
bColorVisionDeficiencyCorrectionPreviewWithDeficiency=False
|
||||||
|
SelectionColor=(R=0.828000,G=0.364000,B=0.003000,A=1.000000)
|
||||||
|
AdditionalSelectionColors[0]=(R=0.019382,G=0.496933,B=1.000000,A=1.000000)
|
||||||
|
AdditionalSelectionColors[1]=(R=0.356400,G=0.040915,B=0.520996,A=1.000000)
|
||||||
|
AdditionalSelectionColors[2]=(R=1.000000,G=0.168269,B=0.332452,A=1.000000)
|
||||||
|
AdditionalSelectionColors[3]=(R=1.000000,G=0.051269,B=0.051269,A=1.000000)
|
||||||
|
AdditionalSelectionColors[4]=(R=1.000000,G=0.715693,B=0.010330,A=1.000000)
|
||||||
|
AdditionalSelectionColors[5]=(R=0.258183,G=0.539479,B=0.068478,A=1.000000)
|
||||||
|
bEnableEditorWindowBackgroundColor=False
|
||||||
|
EditorWindowBackgroundColor=(R=1.000000,G=1.000000,B=1.000000,A=1.000000)
|
||||||
|
bUseSmallToolBarIcons=False
|
||||||
|
bUseGrid=True
|
||||||
|
RegularColor=(R=0.035000,G=0.035000,B=0.035000,A=1.000000)
|
||||||
|
RuleColor=(R=0.008000,G=0.008000,B=0.008000,A=1.000000)
|
||||||
|
CenterColor=(R=0.000000,G=0.000000,B=0.000000,A=1.000000)
|
||||||
|
GridSnapSize=16
|
||||||
|
GraphBackgroundBrush=(bIsDynamicallyLoaded=False,DrawAs=Image,Tiling=NoTile,Mirroring=NoMirror,ImageType=NoImage,ImageSize=(X=32.000000,Y=32.000000),Margin=(Left=0.000000,Top=0.000000,Right=0.000000,Bottom=0.000000),TintColor=(SpecifiedColor=(R=1.000000,G=1.000000,B=1.000000,A=1.000000),ColorUseRule=UseColor_Specified),OutlineSettings=(CornerRadii=(X=0.000000,Y=0.000000,Z=0.000000,W=1.000000),Color=(SpecifiedColor=(R=0.000000,G=0.000000,B=0.000000,A=0.000000),ColorUseRule=UseColor_Specified),Width=0.000000,RoundingType=HalfHeightRadius,bUseBrushTransparency=False),ResourceObject=None,ResourceName="",UVRegion=(Min=(X=0.000000,Y=0.000000),Max=(X=0.000000,Y=0.000000),bIsValid=False))
|
||||||
|
bShowFriendlyNames=True
|
||||||
|
bShowNativeComponentNames=True
|
||||||
|
bExpandConfigurationMenus=False
|
||||||
|
bShowProjectMenus=True
|
||||||
|
bShowLaunchMenus=True
|
||||||
|
bShowAllAdvancedDetails=False
|
||||||
|
bShowHiddenPropertiesWhilePlaying=False
|
||||||
|
AssetEditorOpenLocation=MainWindow
|
||||||
|
bEnableColorizedEditorTabs=True
|
||||||
|
CurrentAppliedTheme=134380265FBB4A9CA00A1DC9770217B8
|
||||||
|
|
||||||
|
|
@ -50,5 +50,16 @@ ManualIPAddress=
|
||||||
|
|
||||||
[/Script/EngineSettings.GameMapsSettings]
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
EditorStartupMap=/Game/Blueprints/Levels/TestMap.TestMap
|
EditorStartupMap=/Game/Blueprints/Levels/TestMap.TestMap
|
||||||
|
LocalMapOptions=
|
||||||
|
TransitionMap=None
|
||||||
|
bUseSplitscreen=True
|
||||||
|
TwoPlayerSplitscreenLayout=Horizontal
|
||||||
|
ThreePlayerSplitscreenLayout=FavorTop
|
||||||
|
FourPlayerSplitscreenLayout=Grid
|
||||||
|
bOffsetPlayerGamepadIds=False
|
||||||
|
GameInstanceClass=/Script/Engine.GameInstance
|
||||||
GameDefaultMap=/Game/Blueprints/Levels/TestMap.TestMap
|
GameDefaultMap=/Game/Blueprints/Levels/TestMap.TestMap
|
||||||
|
ServerDefaultMap=/Engine/Maps/Entry.Entry
|
||||||
|
GlobalDefaultGameMode=/Game/Blueprints/Game/BP_ExoGameMode.BP_ExoGameMode_C
|
||||||
|
GlobalDefaultServerGameMode=None
|
||||||
|
|
||||||
|
|
|
||||||
BIN
Content/Blueprints/Game/BP_ExoGameMode.uasset
Normal file
BIN
Content/Blueprints/Game/BP_ExoGameMode.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Player/BP_ExoPlayerController.uasset
Normal file
BIN
Content/Blueprints/Player/BP_ExoPlayerController.uasset
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -7,7 +7,10 @@
|
||||||
{
|
{
|
||||||
"Name": "Exo",
|
"Name": "Exo",
|
||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "Default"
|
"LoadingPhase": "Default",
|
||||||
|
"AdditionalDependencies": [
|
||||||
|
"Engine"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Plugins": [
|
"Plugins": [
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ public class Exo : ModuleRules
|
||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput"});
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
|
||||||
|
|
|
||||||
34
Source/Exo/Private/Characters/ExoCharacterBase.cpp
Normal file
34
Source/Exo/Private/Characters/ExoCharacterBase.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Characters/ExoCharacterBase.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
AExoCharacterBase::AExoCharacterBase()
|
||||||
|
{
|
||||||
|
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||||
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
void AExoCharacterBase::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void AExoCharacterBase::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called to bind functionality to input
|
||||||
|
void AExoCharacterBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||||
|
{
|
||||||
|
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
5
Source/Exo/Private/Game/ExoGameMode.cpp
Normal file
5
Source/Exo/Private/Game/ExoGameMode.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Game/ExoGameMode.h"
|
||||||
|
|
||||||
66
Source/Exo/Private/Player/ExoPlayerController.cpp
Normal file
66
Source/Exo/Private/Player/ExoPlayerController.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Player/ExoPlayerController.h"
|
||||||
|
#include "EnhancedInputComponent.h"
|
||||||
|
#include "EnhancedInputSubsystems.h"
|
||||||
|
#include "GameFramework/Character.h"
|
||||||
|
|
||||||
|
AExoPlayerController::AExoPlayerController()
|
||||||
|
{
|
||||||
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AExoPlayerController::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
check(InputContext);
|
||||||
|
|
||||||
|
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
||||||
|
|
||||||
|
if (Subsystem)
|
||||||
|
{
|
||||||
|
Subsystem->AddMappingContext(InputContext, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerCharacter = GetPawn<ACharacter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AExoPlayerController::PlayerTick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::PlayerTick(DeltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AExoPlayerController::SetupInputComponent()
|
||||||
|
{
|
||||||
|
Super::SetupInputComponent();
|
||||||
|
|
||||||
|
UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent);
|
||||||
|
|
||||||
|
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AExoPlayerController::Move);
|
||||||
|
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AExoPlayerController::Look);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AExoPlayerController::Move(const FInputActionValue& InputActionValue)
|
||||||
|
{
|
||||||
|
const FVector2D InputAxisVector = InputActionValue.Get<FVector2D>();
|
||||||
|
const FRotator Rotation = GetControlRotation();
|
||||||
|
const FRotator YawRotation(0.f, Rotation.Yaw, 0.f);
|
||||||
|
|
||||||
|
const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
|
||||||
|
const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
|
||||||
|
|
||||||
|
if (PlayerCharacter)
|
||||||
|
{
|
||||||
|
PlayerCharacter->AddMovementInput(ForwardDirection, InputAxisVector.X);
|
||||||
|
PlayerCharacter->AddMovementInput(RightDirection, InputAxisVector.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AExoPlayerController::Look(const FInputActionValue& InputActionValue)
|
||||||
|
{
|
||||||
|
FVector2D InputAxisVector = InputActionValue.Get<FVector2D>();
|
||||||
|
|
||||||
|
AddYawInput(InputAxisVector.X);
|
||||||
|
AddPitchInput(InputAxisVector.Y);
|
||||||
|
}
|
||||||
29
Source/Exo/Public/Characters/ExoCharacterBase.h
Normal file
29
Source/Exo/Public/Characters/ExoCharacterBase.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Character.h"
|
||||||
|
#include "ExoCharacterBase.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class EXO_API AExoCharacterBase : public ACharacter
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this character's properties
|
||||||
|
AExoCharacterBase();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
// Called to bind functionality to input
|
||||||
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
||||||
|
};
|
||||||
17
Source/Exo/Public/Game/ExoGameMode.h
Normal file
17
Source/Exo/Public/Game/ExoGameMode.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/GameModeBase.h"
|
||||||
|
#include "ExoGameMode.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class EXO_API AExoGameMode : public AGameModeBase
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
||||||
46
Source/Exo/Public/Player/ExoPlayerController.h
Normal file
46
Source/Exo/Public/Player/ExoPlayerController.h
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/PlayerController.h"
|
||||||
|
#include "ExoPlayerController.generated.h"
|
||||||
|
|
||||||
|
class UInputMappingContext;
|
||||||
|
class UInputAction;
|
||||||
|
struct FInputActionValue;
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class EXO_API AExoPlayerController : public APlayerController
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
AExoPlayerController();
|
||||||
|
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
virtual void PlayerTick(float DeltaTime) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void SetupInputComponent() override;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
||||||
|
void Move(const FInputActionValue& InputActionValue);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Input")
|
||||||
|
void Look(const FInputActionValue& InputActionValue);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Input")
|
||||||
|
TObjectPtr<UInputMappingContext> InputContext;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category= "Input")
|
||||||
|
TObjectPtr<UInputAction> MoveAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Input")
|
||||||
|
TObjectPtr<UInputAction> LookAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character")
|
||||||
|
TObjectPtr<ACharacter> PlayerCharacter;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user