From ba74f12c4f3cd66aa3f5bbfcaa34dbee61b7f85f Mon Sep 17 00:00:00 2001 From: Ji Yoon Rhee Date: Thu, 3 Oct 2024 22:55:43 +0900 Subject: [PATCH] created new NPC c++ class --- .../{HYEnemy.cpp => HYEnemyBase.cpp} | 12 ++--- .../hwanyoung2/{HYEnemy.h => HYEnemyBase.h} | 10 ++--- hwanyoung2/Source/hwanyoung2/HYWeapon.cpp | 40 ----------------- hwanyoung2/Source/hwanyoung2/HYWeapon.h | 45 ------------------- .../Source/hwanyoung2/hwanyoung2Character.h | 4 +- 5 files changed, 13 insertions(+), 98 deletions(-) rename hwanyoung2/Source/hwanyoung2/{HYEnemy.cpp => HYEnemyBase.cpp} (53%) rename hwanyoung2/Source/hwanyoung2/{HYEnemy.h => HYEnemyBase.h} (70%) delete mode 100644 hwanyoung2/Source/hwanyoung2/HYWeapon.cpp delete mode 100644 hwanyoung2/Source/hwanyoung2/HYWeapon.h diff --git a/hwanyoung2/Source/hwanyoung2/HYEnemy.cpp b/hwanyoung2/Source/hwanyoung2/HYEnemyBase.cpp similarity index 53% rename from hwanyoung2/Source/hwanyoung2/HYEnemy.cpp rename to hwanyoung2/Source/hwanyoung2/HYEnemyBase.cpp index 10d41afe..67a91a48 100644 --- a/hwanyoung2/Source/hwanyoung2/HYEnemy.cpp +++ b/hwanyoung2/Source/hwanyoung2/HYEnemyBase.cpp @@ -1,32 +1,32 @@ // Fill out your copyright notice in the Description page of Project Settings. -#include "HYEnemy.h" +#include "HYEnemyBase.h" // 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; } // Called when the game starts or when spawned -void AHYEnemy::BeginPlay() +void AHYEnemyBase::BeginPlay() { Super::BeginPlay(); } // Called every frame -void AHYEnemy::Tick(float DeltaTime) +void AHYEnemyBase::Tick(float DeltaTime) { Super::Tick(DeltaTime); } // Called to bind functionality to input -void AHYEnemy::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) +void AHYEnemyBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); diff --git a/hwanyoung2/Source/hwanyoung2/HYEnemy.h b/hwanyoung2/Source/hwanyoung2/HYEnemyBase.h similarity index 70% rename from hwanyoung2/Source/hwanyoung2/HYEnemy.h rename to hwanyoung2/Source/hwanyoung2/HYEnemyBase.h index 89418568..cd6af675 100644 --- a/hwanyoung2/Source/hwanyoung2/HYEnemy.h +++ b/hwanyoung2/Source/hwanyoung2/HYEnemyBase.h @@ -3,17 +3,17 @@ #pragma once #include "CoreMinimal.h" -#include "GameFramework/Pawn.h" -#include "HYEnemy.generated.h" +#include "GameFramework/Character.h" +#include "HYEnemyBase.generated.h" UCLASS() -class HWANYOUNG2_API AHYEnemy : public APawn +class HWANYOUNG2_API AHYEnemyBase : public ACharacter { GENERATED_BODY() public: - // Sets default values for this pawn's properties - AHYEnemy(); + // Sets default values for this character's properties + AHYEnemyBase(); protected: // Called when the game starts or when spawned diff --git a/hwanyoung2/Source/hwanyoung2/HYWeapon.cpp b/hwanyoung2/Source/hwanyoung2/HYWeapon.cpp deleted file mode 100644 index a6f2de45..00000000 --- a/hwanyoung2/Source/hwanyoung2/HYWeapon.cpp +++ /dev/null @@ -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) -{ -} - diff --git a/hwanyoung2/Source/hwanyoung2/HYWeapon.h b/hwanyoung2/Source/hwanyoung2/HYWeapon.h deleted file mode 100644 index 0539573a..00000000 --- a/hwanyoung2/Source/hwanyoung2/HYWeapon.h +++ /dev/null @@ -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); -}; diff --git a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h index f6f4bc22..dbe13437 100644 --- a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h +++ b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h @@ -16,11 +16,11 @@ class Ahwanyoung2Character : public ACharacter GENERATED_BODY() /** 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; /** Follow camera */ - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) + UPROPERTY(BlueprintReadWrite, Category = Camera, meta = (AllowPrivateAccess = "true")) class UCameraComponent* FollowCamera; /** Collection sphere */