diff --git a/Source/Nakatomi/Weapon.cpp b/Source/Nakatomi/Weapon.cpp new file mode 100644 index 0000000..7b0f4d2 --- /dev/null +++ b/Source/Nakatomi/Weapon.cpp @@ -0,0 +1,67 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Weapon.h" + +// Sets default values +AWeapon::AWeapon() +{ + +} + +// Called when the game starts or when spawned +void AWeapon::BeginPlay() +{ + Super::BeginPlay(); + +} + +USkeletalMeshComponent* AWeapon::GetSkeletalMesh() +{ + return WeaponSkeletalMesh; +} + +void AWeapon::SetSkeletalMesh(USkeletalMeshComponent* USkeletalMeshComponent) +{ + WeaponSkeletalMesh = USkeletalMeshComponent; +} + +TEnumAsByte* AWeapon::GetCurrentWeaponStatus() +{ + return &CurrentWeaponStatus; +} + +void AWeapon::SetCurrentWeaponStatus(TEnumAsByte NewWeaponStatus) +{ + CurrentWeaponStatus = NewWeaponStatus; +} + +FWeaponProperties* AWeapon::GetWeaponProperties() +{ + return &WeaponProperties; +} + +void AWeapon::SetWeaponProperties(FWeaponProperties FWeaponProperties) +{ + WeaponProperties = FWeaponProperties; +} + +ANakatomiCharacter* AWeapon::GetParentPawn() +{ + return ParentPawn; +} + +void AWeapon::SetParentPawn(ANakatomiCharacter* ANakatomiCharacter) +{ + ParentPawn = ANakatomiCharacter; +} + +USoundBase* AWeapon::GetFireSound() +{ + return FireSound; +} + +void AWeapon::SetFireSound(USoundBase* USoundBase) +{ + FireSound = USoundBase; +} diff --git a/Source/Nakatomi/Weapon.h b/Source/Nakatomi/Weapon.h new file mode 100644 index 0000000..4dbae9b --- /dev/null +++ b/Source/Nakatomi/Weapon.h @@ -0,0 +1,90 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "Weapon.generated.h" + +class ANakatomiCharacter; + +UENUM() +enum WeaponState +{ + Idle, + Firing, + Cooldown, + Swapping +}; + +USTRUCT() +struct FWeaponProperties +{ + GENERATED_USTRUCT_BODY() + + float WeaponCooldown = 1.0f; + + int WeaponDamage = 10; + + float WeaponChangeTime = 2.0f; + + int ProjectilesPerShot = 1; + + float ProjectileRange = 10000.0f; + + float WeaponSpread = 2.5f; + + bool IsAutomatic = true; +}; + +UCLASS(Abstract, Blueprintable) +class NAKATOMI_API AWeapon : public AActor +{ + GENERATED_BODY() + +protected: + + UPROPERTY(EditDefaultsOnly) + USkeletalMeshComponent* WeaponSkeletalMesh; + + UPROPERTY(EditDefaultsOnly) + TEnumAsByte CurrentWeaponStatus; + + UPROPERTY(EditDefaultsOnly) + FWeaponProperties WeaponProperties; + + UPROPERTY(VisibleAnywhere) + ANakatomiCharacter* ParentPawn; + + UPROPERTY(EditDefaultsOnly) + USoundBase* FireSound; + +public: + // Sets default values for this actor's properties + AWeapon(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + USkeletalMeshComponent* GetSkeletalMesh(); + + void SetSkeletalMesh(USkeletalMeshComponent* USkeletalMeshComponent); + + TEnumAsByte* GetCurrentWeaponStatus(); + + void SetCurrentWeaponStatus(TEnumAsByte NewWeaponStatus); + + FWeaponProperties* GetWeaponProperties(); + + void SetWeaponProperties(FWeaponProperties FWeaponProperties); + + ANakatomiCharacter* GetParentPawn(); + + void SetParentPawn(ANakatomiCharacter* ANakatomiCharacter); + + USoundBase* GetFireSound(); + + void SetFireSound(USoundBase* USoundBase); +};