Added docstrings
This commit is contained in:
parent
f50779e621
commit
b468f703f9
@ -14,11 +14,15 @@ struct FLMAmmoData : public FTableRowBase
|
|||||||
EAmmoType AmmoType;
|
EAmmoType AmmoType;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin=1, ClampMax=1000, Uimin=1, Uimax=1000))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin=1, ClampMax=1000, Uimin=1, Uimax=1000))
|
||||||
int MaxAmmo;
|
int MaxAmmo = 32;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin=0, Uimin=0))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin=0, Uimin=0))
|
||||||
int AmmoCount;
|
int AmmoCount = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An utility method to add and
|
||||||
|
* @param Quantity The quantity of ammo to add.
|
||||||
|
*/
|
||||||
void AddAmmo(const int Quantity)
|
void AddAmmo(const int Quantity)
|
||||||
{
|
{
|
||||||
AmmoCount += UKismetMathLibrary::Clamp(Quantity, 0, MaxAmmo);
|
AmmoCount += UKismetMathLibrary::Clamp(Quantity, 0, MaxAmmo);
|
||||||
|
@ -7,27 +7,35 @@ struct FLMBulletInfo
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
/** The number of bullets to fire. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
int BulletCount;
|
int BulletCount;
|
||||||
|
|
||||||
|
/** The bullets' origins. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FVector Origin;
|
FVector Origin;
|
||||||
|
|
||||||
|
/** The main direction vector. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FVector Direction;
|
FVector Direction;
|
||||||
|
|
||||||
|
/** The Random bullet spread angle deviation. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FVector Spread;
|
float Spread;
|
||||||
|
|
||||||
|
/** The maximum distance before the bullet reaches minimum damages. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
float MaxDistance;
|
float MaxDistance;
|
||||||
|
|
||||||
|
/** A curve multiplicating the damage of a bullet depending on the distance of the target. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FFloatCurve Falloff;
|
FFloatCurve Falloff;
|
||||||
|
|
||||||
|
/** The type of bullet that was fired. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
EAmmoType AmmoType;
|
EAmmoType AmmoType;
|
||||||
|
|
||||||
|
/** The default amount of damage to apply per bullet. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
float Damage;
|
float Damage;
|
||||||
};
|
};
|
@ -3,6 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "LMBulletInfo.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "LMPlayer.generated.h"
|
#include "LMPlayer.generated.h"
|
||||||
@ -58,4 +59,7 @@ private:
|
|||||||
|
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<UCameraComponent> Camera;
|
TObjectPtr<UCameraComponent> Camera;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FRandomStream SpreadStream;
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Ammo/LMAmmo.h"
|
#include "Ammo/LMAmmo.h"
|
||||||
#include "LMWeaponDataStructure.h"
|
#include "LMWeaponState.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "LMWeaponBase.generated.h"
|
#include "LMWeaponBase.generated.h"
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ public:
|
|||||||
FName GetAttachmentSocketName() const { return WeaponSocket; }
|
FName GetAttachmentSocketName() const { return WeaponSocket; }
|
||||||
|
|
||||||
protected: /* Weapon Data */
|
protected: /* Weapon Data */
|
||||||
/** The weapon static data. */
|
/** The sound to play when firing. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
|
||||||
FLMWeaponDataStructure Data;
|
TObjectPtr<USoundWave> FireSound;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
||||||
TObjectPtr<UAnimMontage> PrimaryFireAnimation;
|
TObjectPtr<UAnimMontage> PrimaryFireAnimation;
|
||||||
@ -51,11 +51,13 @@ protected: /* Weapon Data */
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
||||||
TObjectPtr<UAnimMontage> ReloadAnimation;
|
TObjectPtr<UAnimMontage> ReloadAnimation;
|
||||||
|
|
||||||
|
/** The flat damage number of one bullet. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||||
float Damage = 10.f;
|
float Damage = 10.f;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
/** The max angle deviation of a bullet from the original ray. In degrees.*/
|
||||||
FVector WeaponSpread = FVector::ZeroVector;
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true, UIMin=0, UIMax=180))
|
||||||
|
float WeaponSpread = 10;
|
||||||
|
|
||||||
/** The max distance (cm) between the origin and the target before doing minimal damage. */
|
/** The max distance (cm) between the origin and the target before doing minimal damage. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||||
@ -69,17 +71,23 @@ protected: /* Weapon Data */
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||||
EAmmoType AmmoType;
|
EAmmoType AmmoType;
|
||||||
|
|
||||||
|
/** The current number of ammo in the clip. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||||
int ClipAmmo;
|
int ClipAmmo;
|
||||||
|
|
||||||
|
/** The maximum amount of ammo in a clip. */
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||||
|
int MaxClip;
|
||||||
|
|
||||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category=Legumix)
|
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category=Legumix)
|
||||||
TObjectPtr<ALMPlayer> Player;
|
TObjectPtr<ALMPlayer> Player;
|
||||||
|
|
||||||
|
/** The current state of the weapon. */
|
||||||
|
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category="Legumix|Weapon")
|
||||||
|
EWeaponState State;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
/** An optional socket to attach the weapon to. */
|
||||||
FDataTableRowHandle DataTableRow;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||||
FName WeaponSocket;
|
FName WeaponSocket;
|
||||||
|
|
||||||
|
@ -10,15 +10,7 @@ struct FLMWeaponDataStructure : public FTableRowBase
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
int MaxClipAmmo;
|
int MaxClipAmmo;
|
||||||
|
|
||||||
/** Mesh of the weapon display in the scene. */
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
TObjectPtr<USkeletalMesh> MeshWeapon;
|
|
||||||
|
|
||||||
/** The animation blueprint to animate the mesh. */
|
/** The animation blueprint to animate the mesh. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TObjectPtr<UAnimBlueprint> AnimationBluePrint;
|
TObjectPtr<UAnimBlueprint> AnimationBluePrint;
|
||||||
|
|
||||||
/** The sound to play when firing. */
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category=Legumix)
|
|
||||||
TObjectPtr<USoundWave> FireSound;
|
|
||||||
};
|
};
|
||||||
|
9
Source/LegumeMix/Public/Weapon/LMWeaponState.h
Normal file
9
Source/LegumeMix/Public/Weapon/LMWeaponState.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
UENUM(Blueprintable)
|
||||||
|
enum class EWeaponState : uint8
|
||||||
|
{
|
||||||
|
EWS_Idle = 0 UMETA(DisplayName = "Idle"),
|
||||||
|
EWS_Firing = 1 UMETA(DisplayName = "Firing"),
|
||||||
|
EWS_Reloading = 2 UMETA(DisplayName = "Reloading"),
|
||||||
|
};
|
Reference in New Issue
Block a user