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:
9
Source/M4_CPP/private/M4_CPP.cpp
Normal file
9
Source/M4_CPP/private/M4_CPP.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user