Created Custom FP Character with custom Interact

Created a Temp Character script and gave it functionallity, also gave it the custom keybind E so when pressed it displays a log message so I know it works. Also created a temporary gamemode for merchant level
This commit is contained in:
MH261677 2022-11-10 11:52:10 +00:00
parent d96c540bcf
commit fb981ce2d6
6 changed files with 96 additions and 3 deletions

View File

@ -28,6 +28,6 @@ bOffsetPlayerGamepadIds=False
GameInstanceClass=/Script/Engine.GameInstance
GameDefaultMap=/Game/Levels/Main.Main
ServerDefaultMap=/Engine/Maps/Entry.Entry
GlobalDefaultGameMode=/Script/Engine.GameModeBase
GlobalDefaultGameMode=/Game/Merchant/BP_MerchantGameMode.BP_MerchantGameMode_C
GlobalDefaultServerGameMode=None

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e80b44e582d11e6ad42033c0a1a16231f6301999bae071ebfb5b4e873f21d127
size 22069

BIN
Content/Levels/MerchantPrototype.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Merchant/BP_MerchantGameMode.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,54 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TempCharacter.h"
#include "../../../Plugins/Developer/RiderLink/Source/RD/thirdparty/clsocket/src/ActiveSocket.h"
// Sets default values
ATempCharacter::ATempCharacter()
{
// 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 ATempCharacter::BeginPlay()
{
Super::BeginPlay();
}
void ATempCharacter::ForwardInput(float Axis)
{
AddMovementInput(GetActorForwardVector()* Axis);
}
void ATempCharacter::RightMoveInput(float Axis)
{
AddMovementInput(GetActorRightVector()* Axis);
}
// Called every frame
void ATempCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ATempCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("Move Forward / Backward"), this, &ATempCharacter::ForwardInput);
PlayerInputComponent->BindAxis(TEXT("Move Right / Left"), this, &ATempCharacter::RightMoveInput);
PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput);
PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput);
PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
}
void ATempCharacter::KeyPressed(FKey Interact)
{
UE_LOG(LogTemp, Display, TEXT("Interact key is being pressed"));
}

View File

@ -0,0 +1,33 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "TempCharacter.generated.h"
UCLASS()
class THE_TWILIGHT_ABYSS_API ATempCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ATempCharacter();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void ForwardInput(float Axis);
void RightMoveInput(float Axis);
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
void KeyPressed(FKey Interact);
};