created new NPC c++ class

This commit is contained in:
Ji Yoon Rhee 2024-10-03 22:55:43 +09:00
parent a5540f5bbc
commit ba74f12c4f
5 changed files with 13 additions and 98 deletions

View File

@ -1,32 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "HYEnemy.h" #include "HYEnemyBase.h"
// Sets default values // Sets default values
AHYEnemy::AHYEnemy() AHYEnemyBase::AHYEnemyBase()
{ {
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. // 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; PrimaryActorTick.bCanEverTick = true;
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned
void AHYEnemy::BeginPlay() void AHYEnemyBase::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
} }
// Called every frame // Called every frame
void AHYEnemy::Tick(float DeltaTime) void AHYEnemyBase::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
} }
// Called to bind functionality to input // Called to bind functionality to input
void AHYEnemy::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) void AHYEnemyBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{ {
Super::SetupPlayerInputComponent(PlayerInputComponent); Super::SetupPlayerInputComponent(PlayerInputComponent);

View File

@ -3,17 +3,17 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/Pawn.h" #include "GameFramework/Character.h"
#include "HYEnemy.generated.h" #include "HYEnemyBase.generated.h"
UCLASS() UCLASS()
class HWANYOUNG2_API AHYEnemy : public APawn class HWANYOUNG2_API AHYEnemyBase : public ACharacter
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
// Sets default values for this pawn's properties // Sets default values for this character's properties
AHYEnemy(); AHYEnemyBase();
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned

View File

@ -1,40 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "HYWeapon.h"
// Sets default values
AHYWeapon::AHYWeapon()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
AHYWeapon::AHYWeapon(float atkDmg, float critDmg, float critRt)
{
attackDamage = atkDmg;
critDamage = critDmg;
critRate = critRt;
}
// Called when the game starts or when spawned
void AHYWeapon::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AHYWeapon::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AHYWeapon::UseWeapon(AHYEnemy* target)
{
}

View File

@ -1,45 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "HYEnemy.h"
#include "HYWeapon.generated.h"
UCLASS()
class HWANYOUNG2_API AHYWeapon : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AHYWeapon();
AHYWeapon(float atkDmg, float critDmg, float critRt);
float attackDamage; //flat numbers for attack damage
float critDamage; //flat numbers for crit damage
float critRate; //percentage rate of how likely one hits a crit dmg
/* smth to think about in later epics:
* hit stop - this is more an event+animation frame related thing
* knock back - this is more of status effect stuff
*/
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
/*
*/
virtual void UseWeapon(AHYEnemy* target);
};

View File

@ -16,11 +16,11 @@ class Ahwanyoung2Character : public ACharacter
GENERATED_BODY() GENERATED_BODY()
/** Camera boom positioning the camera behind the character */ /** Camera boom positioning the camera behind the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) UPROPERTY(BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
class USpringArmComponent* CameraBoom; class USpringArmComponent* CameraBoom;
/** Follow camera */ /** Follow camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) UPROPERTY(BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true"))
class UCameraComponent* FollowCamera; class UCameraComponent* FollowCamera;
/** Collection sphere */ /** Collection sphere */