2024-04-12 11:49:22 -07:00
|
|
|
#include "GasaCharacter.h"
|
|
|
|
|
2024-04-12 16:55:34 -07:00
|
|
|
#include "Camera/CameraComponent.h"
|
2024-04-12 19:05:09 -07:00
|
|
|
#include "Components/CapsuleComponent.h"
|
2024-04-12 16:55:34 -07:00
|
|
|
#include "GameFramework/CharacterMovementComponent.h"
|
|
|
|
#include "GameFramework/SpringArmComponent.h"
|
2024-04-12 19:05:09 -07:00
|
|
|
#include "Kismet/KismetSystemLibrary.h"
|
2024-04-12 16:55:34 -07:00
|
|
|
|
2024-04-12 19:05:09 -07:00
|
|
|
void AGasaCharacter::SetHighlight(EHighlight Desired)
|
2024-04-12 17:16:25 -07:00
|
|
|
{
|
2024-04-12 19:05:09 -07:00
|
|
|
HighlightState = Desired;
|
2024-04-12 17:16:25 -07:00
|
|
|
}
|
|
|
|
|
2024-04-12 11:49:22 -07:00
|
|
|
AGasaCharacter::AGasaCharacter()
|
|
|
|
{
|
|
|
|
PrimaryActorTick.bCanEverTick = false;
|
|
|
|
|
2024-04-12 16:55:34 -07:00
|
|
|
UCharacterMovementComponent*
|
|
|
|
Movement = GetCharacterMovement();
|
|
|
|
Movement->bOrientRotationToMovement = true;
|
|
|
|
Movement->bConstrainToPlane = true;
|
|
|
|
Movement->bSnapToPlaneAtStart = true;
|
|
|
|
Movement->RotationRate = FRotator(0.0, 400.f, 0.0);
|
|
|
|
|
|
|
|
bUseControllerRotationPitch = false;
|
|
|
|
bUseControllerRotationRoll = false;
|
|
|
|
bUseControllerRotationYaw = false;
|
|
|
|
|
|
|
|
USceneComponent* root_component = GetRootComponent();
|
|
|
|
USkeletalMeshComponent* mesh = GetMesh();
|
|
|
|
|
|
|
|
CamSpringArm = CreateDefaultSubobject<USpringArmComponent>("Camera Spring Arm");
|
|
|
|
CamSpringArm->SetupAttachment(root_component);
|
|
|
|
CamSpringArm->SetRelativeRotation( FQuat::MakeFromEuler(FVector(0.0, -35.0, 0.0)));
|
|
|
|
CamSpringArm->TargetArmLength = 400.0f;
|
|
|
|
|
|
|
|
CamSpringArm->bInheritPitch = false;
|
|
|
|
CamSpringArm->bInheritYaw = false;
|
|
|
|
CamSpringArm->bInheritRoll = false;
|
|
|
|
|
|
|
|
Camera = CreateDefaultSubobject<UCameraComponent>("Camera");
|
|
|
|
Camera->SetupAttachment(CamSpringArm);
|
|
|
|
|
2024-04-12 11:49:22 -07:00
|
|
|
Weapon = CreateDefaultSubobject<USkeletalMeshComponent>("Weapon");
|
2024-04-12 16:55:34 -07:00
|
|
|
Weapon->SetupAttachment(mesh, FName("WeaponAttach"));
|
2024-04-12 11:49:22 -07:00
|
|
|
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGasaCharacter::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
|
|
|
}
|
2024-04-12 19:05:09 -07:00
|
|
|
|
|
|
|
void AGasaCharacter::Tick(float DeltaSeconds)
|
|
|
|
{
|
|
|
|
Super::Tick(DeltaSeconds);
|
|
|
|
|
|
|
|
switch (HighlightState)
|
|
|
|
{
|
|
|
|
case EHighlight::Disabled:
|
|
|
|
break;
|
|
|
|
case EHighlight::Enabled:
|
|
|
|
{
|
|
|
|
UCapsuleComponent* Capsule = GetCapsuleComponent();
|
|
|
|
|
|
|
|
UKismetSystemLibrary::DrawDebugCapsule(this
|
|
|
|
, Capsule->GetComponentLocation()
|
|
|
|
, Capsule->GetScaledCapsuleHalfHeight()
|
|
|
|
, Capsule->GetScaledCapsuleRadius()
|
|
|
|
, Capsule->GetComponentRotation()
|
|
|
|
, FLinearColor(0.8, 0.32, 0.05f, 1.f)
|
|
|
|
, 0.f
|
|
|
|
, 1.f
|
|
|
|
);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|