119 lines
3.5 KiB
C++
119 lines
3.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "InputAction.h"
|
|
#include "hwanyoung2.h"
|
|
#include "Components/SphereComponent.h"
|
|
#include "hwanyoung2Character.generated.h"
|
|
|
|
|
|
UCLASS(config=Game)
|
|
class Ahwanyoung2Character : public ACharacter
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
/** Camera boom positioning the camera behind the character */
|
|
UPROPERTY(BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
|
class USpringArmComponent* CameraBoom;
|
|
|
|
/** Follow camera */
|
|
UPROPERTY(BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
|
class UCameraComponent* FollowCamera;
|
|
|
|
/** Collection sphere */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
|
|
class USphereComponent* CollectionSphere;
|
|
|
|
#pragma region Character Gameplay Input Action
|
|
/** MappingContext */
|
|
UPROPERTY(EditAnywhere, Category = Input, meta = (AllowPrivateAccess = "true"))
|
|
class UInputMappingContext* InputMapping;
|
|
|
|
/** Jump Input Action */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
|
class UInputAction* JumpAction;
|
|
|
|
/** Move Input Action */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
|
class UInputAction* MoveAction;
|
|
|
|
/** Look Input Action */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
|
class UInputAction* LookAction;
|
|
|
|
/** Walk Input Action */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
|
class UInputAction* WalkAction;
|
|
|
|
#pragma endregion
|
|
|
|
private:
|
|
//Helper function for
|
|
void Initialize();
|
|
|
|
public:
|
|
|
|
Ahwanyoung2Character();
|
|
|
|
//Updates the AbilitysystemComponent's actorInfo, especially in a multiplayer environment
|
|
//Gets called on the server (so basically my end)
|
|
virtual void PossessedBy(AController* NewController) override;
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
|
|
float GetStartingCameraBoomArmLength();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "HY_Character|Camera")
|
|
FVector GetStartingCameraBoomLocation();
|
|
|
|
|
|
/** Returns CameraBoom subobject **/
|
|
class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
|
|
/** Returns FollowCamera subobject **/
|
|
class UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
|
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
protected:
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
|
|
float StartingCameraBoomArmLength;
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category = "HY_Character|Camera")
|
|
FVector StartingCameraBoomLocation;
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "HY_Character|Camera")
|
|
float BaseTurnRate = 45.0f;
|
|
|
|
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "HY_Character|Camera")
|
|
float BaseLookUpRate = 45.0f;
|
|
|
|
|
|
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Hwanyoung|Character")
|
|
FText CharacterName;
|
|
|
|
/** Called for movement input */
|
|
void Move(const FInputActionValue& Value);
|
|
|
|
/** Called for looking input */
|
|
void Look(const FInputActionValue& Value);
|
|
|
|
/** Called for checking for the closest Interactable in sight and in range*/
|
|
void CheckForInteractables();
|
|
|
|
/** Called for collecting automatic pick-upable interactables*/
|
|
void CollectAutoPickups();
|
|
|
|
protected:
|
|
// APawn interface
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
|
|
// To add mapping context
|
|
virtual void BeginPlay();
|
|
|
|
};
|
|
|