// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Item.h" #include "AmmoType.h" #include "Weapon.generated.h" UENUM(BlueprintType) enum class EWeaponType: uint8 { EWT_SubmachineGun UMETA(DisplayName = "SubmachineGun"), EWT_AssaultRifle UMETA(DisplayName = "AssaultRifle"), EWT_MAX UMETA(DisplayName = "DefaultMax"), }; /** * */ UCLASS() class SHOOTER_API AWeapon : public AItem { GENERATED_BODY() public: AWeapon(); virtual void Tick(float DeltaTime) override; protected: void StopFalling(); private: FTimerHandle ThrowWeaponTimer; float ThrowWeaponTime; bool bFalling; /** Ammo count for this weapon */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) int32 Ammo; /** Max ammo that our weapon can hold */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) int32 MagazineCapacity; /** Type of weapon */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) EWeaponType WeaponType; /** Type of ammo for this weapon */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) EAmmoType AmmoType; /** FName for the reload montage section */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) FName ReloadMontageSection; /** True when moving the clip while reloading */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) bool bMovingClip; /** FName for the clip bone */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Properties", meta = (AllowPrivateAccess = "true")) FName ClipBoneName; public: /** Adds an impulse to the weapon */ void ThrowWeapon(); FORCEINLINE int32 GetAmmo() const { return Ammo; } /** Called from Character class when firing weapon */ void DecrementAmmo(); FORCEINLINE EWeaponType GetWeaponType() const { return WeaponType; } FORCEINLINE EAmmoType GetAmmoType() const { return AmmoType; } FORCEINLINE int32 GetMagazineCapacity() const { return MagazineCapacity; } FORCEINLINE FName GetReloadMontageSection() const { return ReloadMontageSection; } FORCEINLINE FName GetClipBoneName() const { return ClipBoneName; } void ReloadAmmo(int32 Amount); FORCEINLINE void SetMovingClip(bool Move) { bMovingClip = Move; }; bool ClipIsFull(); };