Compare commits
3 Commits
6c2e8fc163
...
fef6bd8e3e
Author | SHA1 | Date | |
---|---|---|---|
fef6bd8e3e | |||
bcf4af827c | |||
c69563f6a3 |
BIN
Content/Blueprints/Character/ABP_Enemy.uasset
Normal file
BIN
Content/Blueprints/Character/ABP_Enemy.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Character/Aura/ABP_Aura.uasset
Normal file
BIN
Content/Blueprints/Character/Aura/ABP_Aura.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Character/GoblinSpear/ABP_GoblinSPear.uasset
Normal file
BIN
Content/Blueprints/Character/GoblinSpear/ABP_GoblinSPear.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Game/BP_AuraGameModeBase.uasset
Normal file
BIN
Content/Blueprints/Game/BP_AuraGameModeBase.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Input/IMC_AuraContext.uasset
Normal file
BIN
Content/Blueprints/Input/IMC_AuraContext.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Input/InputActions/IA_Move.uasset
Normal file
BIN
Content/Blueprints/Input/InputActions/IA_Move.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Player/BP_AuraPlayerController.uasset
Normal file
BIN
Content/Blueprints/Player/BP_AuraPlayerController.uasset
Normal file
Binary file not shown.
Binary file not shown.
@ -8,7 +8,7 @@ public class Aura : ModuleRules
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
|
@ -3,3 +3,35 @@
|
||||
|
||||
#include "Character/AuraCharacter.h"
|
||||
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
|
||||
AAuraCharacter::AAuraCharacter()
|
||||
{
|
||||
SpringArm = CreateDefaultSubobject<USpringArmComponent>("SpringArm");
|
||||
SpringArm->TargetArmLength = 700.f;
|
||||
SpringArm->bEnableCameraLag = true;
|
||||
SpringArm->CameraLagSpeed = 10;
|
||||
SpringArm->bUsePawnControlRotation = false;
|
||||
|
||||
SpringArm->bInheritPitch = false;
|
||||
SpringArm->bInheritRoll = false;
|
||||
SpringArm->bInheritYaw = false;
|
||||
|
||||
SpringArm->SetRelativeRotation (FRotator (0.f, -45.f, 0.f));
|
||||
SpringArm->SetupAttachment(GetRootComponent ());
|
||||
|
||||
Camera = CreateDefaultSubobject<UCameraComponent>("Camera");
|
||||
Camera->bUsePawnControlRotation = false;
|
||||
Camera->SetupAttachment(SpringArm);
|
||||
|
||||
GetCharacterMovement()->bOrientRotationToMovement = true;
|
||||
GetCharacterMovement()->RotationRate = FRotator (0.f, 400.f, 0.f);
|
||||
GetCharacterMovement()->bConstrainToPlane = true;
|
||||
GetCharacterMovement()->bSnapToPlaneAtStart = true;
|
||||
|
||||
bUseControllerRotationPitch = false;
|
||||
bUseControllerRotationYaw = false;
|
||||
bUseControllerRotationRoll = false;
|
||||
}
|
||||
|
5
Source/Aura/Private/Game/AuraGameModeBase.cpp
Normal file
5
Source/Aura/Private/Game/AuraGameModeBase.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// Copyright; GhostPacket Games
|
||||
|
||||
|
||||
#include "Game/AuraGameModeBase.h"
|
||||
|
55
Source/Aura/Private/Player/AuraPlayerController.cpp
Normal file
55
Source/Aura/Private/Player/AuraPlayerController.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright; GhostPacket Games
|
||||
|
||||
|
||||
#include "Player/AuraPlayerController.h"
|
||||
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
|
||||
AAuraPlayerController::AAuraPlayerController()
|
||||
{
|
||||
bReplicates = true;
|
||||
}
|
||||
|
||||
void AAuraPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
check(AuraContext); // checks it's set
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem <UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer ());
|
||||
check (Subsystem);
|
||||
Subsystem->AddMappingContext (AuraContext, 0);
|
||||
|
||||
bShowMouseCursor = true;
|
||||
DefaultMouseCursor = EMouseCursor::Default;
|
||||
|
||||
FInputModeGameAndUI InputModeData;
|
||||
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||
InputModeData.SetHideCursorDuringCapture(false);
|
||||
SetInputMode (InputModeData);
|
||||
}
|
||||
|
||||
void AAuraPlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
||||
UEnhancedInputComponent *EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent);
|
||||
EnhancedInputComponent->BindAction (MoveAction, ETriggerEvent::Triggered, this, &AAuraPlayerController::Move);
|
||||
}
|
||||
|
||||
void AAuraPlayerController::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);
|
||||
|
||||
APawn *ControlledPawn = GetPawn<APawn>();
|
||||
if (!ControlledPawn)
|
||||
return;
|
||||
|
||||
ControlledPawn->AddMovementInput(ForwardDirection, InputAxisVector.Y);
|
||||
ControlledPawn->AddMovementInput(RightDirection, InputAxisVector.X);
|
||||
}
|
@ -6,12 +6,21 @@
|
||||
#include "Character/AuraCharacterBase.h"
|
||||
#include "AuraCharacter.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class USpringArmComponent;
|
||||
class UCameraComponent;
|
||||
|
||||
UCLASS()
|
||||
class AURA_API AAuraCharacter : public AAuraCharacterBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAuraCharacter ();
|
||||
|
||||
private:
|
||||
UPROPERTY (EditAnywhere)
|
||||
TObjectPtr<USpringArmComponent> SpringArm;
|
||||
|
||||
UPROPERTY (EditAnywhere)
|
||||
TObjectPtr<UCameraComponent> Camera;
|
||||
};
|
||||
|
17
Source/Aura/Public/Game/AuraGameModeBase.h
Normal file
17
Source/Aura/Public/Game/AuraGameModeBase.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright; GhostPacket Games
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "AuraGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API AAuraGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
34
Source/Aura/Public/Player/AuraPlayerController.h
Normal file
34
Source/Aura/Public/Player/AuraPlayerController.h
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright; GhostPacket Games
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "AuraPlayerController.generated.h"
|
||||
|
||||
class UInputMappingContext;
|
||||
class UInputAction;
|
||||
|
||||
struct FInputActionValue;
|
||||
|
||||
UCLASS()
|
||||
class AURA_API AAuraPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAuraPlayerController ();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
virtual void SetupInputComponent() override;
|
||||
|
||||
private:
|
||||
UPROPERTY (EditAnywhere, Category = "Input")
|
||||
TObjectPtr<UInputMappingContext> AuraContext;
|
||||
|
||||
UPROPERTY (EditAnywhere, Category = "Input")
|
||||
TObjectPtr<UInputAction> MoveAction;
|
||||
|
||||
void Move (const FInputActionValue &InputActionValue);
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
// Copyright; GhostPacket Games
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "AuraCharacterBase.generated.h"
|
||||
|
||||
UCLASS(Abstract) // Abstract so that it cannot be dragged to a level
|
||||
class AURA_API AAuraCharacterBase : public ACharacter
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAuraCharacterBase();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
// Copyright; GhostPacket Games
|
||||
#include "Character/AuraCharacterBase.h"
|
||||
|
||||
AAuraCharacterBase::AAuraCharacterBase()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
}
|
||||
|
||||
void AAuraCharacterBase::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user