diff --git a/.idea/.idea.M4_CPP.dir/.idea/vcs.xml b/.idea/.idea.M4_CPP.dir/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.M4_CPP.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Content/CTP/L_Default.umap b/Content/CTP/L_Default.umap new file mode 100644 index 0000000..ae213e2 Binary files /dev/null and b/Content/CTP/L_Default.umap differ diff --git a/Source/M4_CPP/M4_CPP.cpp b/Source/M4_CPP/private/M4_CPP.cpp similarity index 78% rename from Source/M4_CPP/M4_CPP.cpp rename to Source/M4_CPP/private/M4_CPP.cpp index 190f4da..fe42e6d 100644 --- a/Source/M4_CPP/M4_CPP.cpp +++ b/Source/M4_CPP/private/M4_CPP.cpp @@ -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" ); diff --git a/Source/M4_CPP/private/M4_Centipede.cpp b/Source/M4_CPP/private/M4_Centipede.cpp new file mode 100644 index 0000000..2c3949f --- /dev/null +++ b/Source/M4_CPP/private/M4_Centipede.cpp @@ -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); +} + diff --git a/Source/M4_CPP/private/M4_Gamemode.cpp b/Source/M4_CPP/private/M4_Gamemode.cpp new file mode 100644 index 0000000..b16f27c --- /dev/null +++ b/Source/M4_CPP/private/M4_Gamemode.cpp @@ -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(); +} \ No newline at end of file diff --git a/Source/M4_CPP/private/M4_PlayerController.cpp b/Source/M4_CPP/private/M4_PlayerController.cpp new file mode 100644 index 0000000..2f53180 --- /dev/null +++ b/Source/M4_CPP/private/M4_PlayerController.cpp @@ -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(); +} \ No newline at end of file diff --git a/Source/M4_CPP/private/M4_PlayerPawn.cpp b/Source/M4_CPP/private/M4_PlayerPawn.cpp new file mode 100644 index 0000000..697bd76 --- /dev/null +++ b/Source/M4_CPP/private/M4_PlayerPawn.cpp @@ -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(TEXT("RootComponent")); + + MeshComponent = CreateDefaultSubobject(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(PlayerInputComponent)) + { + if (MoveAction) + { + EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AM4_PlayerPawn::Move); + } + } +} \ No newline at end of file diff --git a/Source/M4_CPP/M4_CPP.h b/Source/M4_CPP/public/M4_CPP.h similarity index 100% rename from Source/M4_CPP/M4_CPP.h rename to Source/M4_CPP/public/M4_CPP.h diff --git a/Source/M4_CPP/public/M4_Centipede.h b/Source/M4_CPP/public/M4_Centipede.h new file mode 100644 index 0000000..57afb88 --- /dev/null +++ b/Source/M4_CPP/public/M4_Centipede.h @@ -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; +}; diff --git a/Source/M4_CPP/public/M4_Gamemode.h b/Source/M4_CPP/public/M4_Gamemode.h new file mode 100644 index 0000000..576a910 --- /dev/null +++ b/Source/M4_CPP/public/M4_Gamemode.h @@ -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; + + +}; diff --git a/Source/M4_CPP/public/M4_LOG.h b/Source/M4_CPP/public/M4_LOG.h new file mode 100644 index 0000000..d9600e7 --- /dev/null +++ b/Source/M4_CPP/public/M4_LOG.h @@ -0,0 +1,5 @@ +#pragma once + +#include "CoreMinimal.h" + +DECLARE_LOG_CATEGORY_EXTERN(M4_CPP, Log, All); \ No newline at end of file diff --git a/Source/M4_CPP/public/M4_PlayerController.h b/Source/M4_CPP/public/M4_PlayerController.h new file mode 100644 index 0000000..26c6590 --- /dev/null +++ b/Source/M4_CPP/public/M4_PlayerController.h @@ -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: + +}; diff --git a/Source/M4_CPP/public/M4_PlayerPawn.h b/Source/M4_CPP/public/M4_PlayerPawn.h new file mode 100644 index 0000000..481a906 --- /dev/null +++ b/Source/M4_CPP/public/M4_PlayerPawn.h @@ -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 MoveAction; + +protected: + virtual void BeginPlay() override; + +private: + + UPROPERTY(Category = "Centipede", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) + TObjectPtr MeshComponent; + + + +};