Adds initial project structure and core classes
Sets up the initial Unreal Engine project structure. Includes the creation of core classes such as: - A custom GameMode - A PlayerController - A PlayerPawn - A Centipede Pawn Also configures Git integration and includes a default level.
This commit is contained in:
6
.idea/.idea.M4_CPP.dir/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.M4_CPP.dir/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
BIN
Content/CTP/L_Default.umap
Normal file
BIN
Content/CTP/L_Default.umap
Normal file
Binary file not shown.
@@ -2,5 +2,8 @@
|
||||
|
||||
#include "M4_CPP.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "M4_LOG.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(M4_CPP)
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, M4_CPP, "M4_CPP" );
|
||||
32
Source/M4_CPP/private/M4_Centipede.cpp
Normal file
32
Source/M4_CPP/private/M4_Centipede.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "M4_Centipede.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
AM4_Centipede::AM4_Centipede()
|
||||
{
|
||||
// Set this pawn 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 AM4_Centipede::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AM4_Centipede::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
}
|
||||
|
||||
// Called to bind functionality to input
|
||||
void AM4_Centipede::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
{
|
||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||
}
|
||||
|
||||
14
Source/M4_CPP/private/M4_Gamemode.cpp
Normal file
14
Source/M4_CPP/private/M4_Gamemode.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#include "M4_Gamemode.h"
|
||||
|
||||
AM4_Gamemode::AM4_Gamemode()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
|
||||
}
|
||||
|
||||
void AM4_Gamemode::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
}
|
||||
18
Source/M4_CPP/private/M4_PlayerController.cpp
Normal file
18
Source/M4_CPP/private/M4_PlayerController.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "M4_PlayerController.h"
|
||||
|
||||
AM4_PlayerController::AM4_PlayerController()
|
||||
{
|
||||
}
|
||||
|
||||
void AM4_PlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
void AM4_PlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
}
|
||||
44
Source/M4_CPP/private/M4_PlayerPawn.cpp
Normal file
44
Source/M4_CPP/private/M4_PlayerPawn.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "M4_PlayerPawn.h"
|
||||
|
||||
AM4_PlayerPawn::AM4_PlayerPawn()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
|
||||
SpawnCollisionHandlingMethod = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
|
||||
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
|
||||
|
||||
MeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComponent"));
|
||||
|
||||
MeshComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
|
||||
MeshComponent->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
|
||||
MeshComponent->SetRelativeScale3D(FVector(1.0f, 1.0f, 1.0f));
|
||||
MeshComponent->SetupAttachment(RootComponent);
|
||||
}
|
||||
void AM4_PlayerPawn::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
void AM4_PlayerPawn::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
void AM4_PlayerPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
{
|
||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||
|
||||
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
|
||||
{
|
||||
if (MoveAction)
|
||||
{
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AM4_PlayerPawn::Move);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Source/M4_CPP/public/M4_Centipede.h
Normal file
28
Source/M4_CPP/public/M4_Centipede.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "M4_Centipede.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class M4_CPP_API AM4_Centipede : public APawn
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this pawn's properties
|
||||
AM4_Centipede();
|
||||
|
||||
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;
|
||||
};
|
||||
24
Source/M4_CPP/public/M4_Gamemode.h
Normal file
24
Source/M4_CPP/public/M4_Gamemode.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "M4_Gamemode.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class M4_CPP_API AM4_Gamemode : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
AM4_Gamemode();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
|
||||
};
|
||||
5
Source/M4_CPP/public/M4_LOG.h
Normal file
5
Source/M4_CPP/public/M4_LOG.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(M4_CPP, Log, All);
|
||||
28
Source/M4_CPP/public/M4_PlayerController.h
Normal file
28
Source/M4_CPP/public/M4_PlayerController.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "M4_PlayerController.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class M4_CPP_API AM4_PlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AM4_PlayerController();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
protected:
|
||||
virtual void SetupInputComponent() override;
|
||||
virtual void OnPossess();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
43
Source/M4_CPP/public/M4_PlayerPawn.h
Normal file
43
Source/M4_CPP/public/M4_PlayerPawn.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "InputAction.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "M4_PlayerPawn.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class M4_CPP_API AM4_PlayerPawn : public APawn
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public :
|
||||
AM4_PlayerPawn();
|
||||
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UStaticMeshComponent* GetMeshComponent() const { return MeshComponent; }
|
||||
|
||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="centipede")
|
||||
TObjectPtr<UInputAction> MoveAction;
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(Category = "Centipede", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<UStaticMeshComponent> MeshComponent;
|
||||
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user