94 lines
3.0 KiB
C++
94 lines
3.0 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Ammo/LMAmmo.h"
|
|
#include "LMWeaponDataStructure.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "LMWeaponBase.generated.h"
|
|
|
|
|
|
class ALMPlayer;
|
|
|
|
UCLASS()
|
|
class LEGUMEMIX_API ALMWeaponBase : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ALMWeaponBase();
|
|
virtual void BeginPlay() override;
|
|
void Setup(USkeletalMeshComponent* Mesh, AActor* CharOwner);
|
|
|
|
public:
|
|
UFUNCTION(BlueprintCallable)
|
|
virtual void Reload();
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
virtual void PrimaryFire();
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void PlaySound(USoundWave* Sound, bool Replacing = false);
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void PlayAnimation(UAnimMontage* Animation);
|
|
|
|
/** The socket to attach the weapon to.
|
|
* @return The socket.
|
|
*/
|
|
UFUNCTION(BlueprintCallable)
|
|
FName GetAttachmentSocketName() const { return WeaponSocket; }
|
|
|
|
protected: /* Weapon Data */
|
|
/** The weapon static data. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
FLMWeaponDataStructure Data;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
|
TObjectPtr<UAnimMontage> PrimaryFireAnimation;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
|
TObjectPtr<UAnimMontage> ReloadAnimation;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
float Damage = 10.f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
FVector WeaponSpread = FVector::ZeroVector;
|
|
|
|
/** The max distance (cm) between the origin and the target before doing minimal damage. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
float MaxDistance = 100000.f;
|
|
|
|
/** The damage falloff distance in a 0-1 scale. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
FFloatCurve DamageFalloff;
|
|
|
|
/** The type of ammo used by this weapon. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
EAmmoType AmmoType;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
|
int ClipAmmo;
|
|
|
|
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category=Legumix)
|
|
TObjectPtr<ALMPlayer> Player;
|
|
|
|
|
|
private:
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
FDataTableRowHandle DataTableRow;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
FName WeaponSocket;
|
|
|
|
private: /* Components */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
TObjectPtr<UAudioComponent> AudioComponent;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true))
|
|
TObjectPtr<USkeletalMeshComponent> WeaponMesh;
|
|
};
|
|
|