Added docstrings
This commit is contained in:
parent
f50779e621
commit
b468f703f9
@ -14,11 +14,15 @@ struct FLMAmmoData : public FTableRowBase
|
||||
EAmmoType AmmoType;
|
||||
|
||||
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))
|
||||
int AmmoCount;
|
||||
int AmmoCount = 8;
|
||||
|
||||
/**
|
||||
* An utility method to add and
|
||||
* @param Quantity The quantity of ammo to add.
|
||||
*/
|
||||
void AddAmmo(const int Quantity)
|
||||
{
|
||||
AmmoCount += UKismetMathLibrary::Clamp(Quantity, 0, MaxAmmo);
|
||||
|
@ -7,27 +7,35 @@ struct FLMBulletInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** The number of bullets to fire. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int BulletCount;
|
||||
|
||||
|
||||
/** The bullets' origins. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FVector Origin;
|
||||
|
||||
|
||||
/** The main direction vector. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FVector Direction;
|
||||
|
||||
|
||||
/** The Random bullet spread angle deviation. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FVector Spread;
|
||||
|
||||
float Spread;
|
||||
|
||||
/** The maximum distance before the bullet reaches minimum damages. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float MaxDistance;
|
||||
|
||||
|
||||
/** A curve multiplicating the damage of a bullet depending on the distance of the target. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FFloatCurve Falloff;
|
||||
|
||||
|
||||
/** The type of bullet that was fired. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
EAmmoType AmmoType;
|
||||
|
||||
|
||||
/** The default amount of damage to apply per bullet. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float Damage;
|
||||
};
|
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "LMBulletInfo.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "LMPlayer.generated.h"
|
||||
@ -58,4 +59,7 @@ private:
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||
TObjectPtr<UCameraComponent> Camera;
|
||||
|
||||
private:
|
||||
FRandomStream SpreadStream;
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Ammo/LMAmmo.h"
|
||||
#include "LMWeaponDataStructure.h"
|
||||
#include "LMWeaponState.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "LMWeaponBase.generated.h"
|
||||
|
||||
@ -41,9 +41,9 @@ public:
|
||||
FName GetAttachmentSocketName() const { return WeaponSocket; }
|
||||
|
||||
protected: /* Weapon Data */
|
||||
/** The weapon static data. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||
FLMWeaponDataStructure Data;
|
||||
/** The sound to play when firing. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category="Legumix|Sounds")
|
||||
TObjectPtr<USoundWave> FireSound;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
||||
TObjectPtr<UAnimMontage> PrimaryFireAnimation;
|
||||
@ -51,11 +51,13 @@ protected: /* Weapon Data */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Legumix|Animations", meta=(AllowPrivateAccess=true))
|
||||
TObjectPtr<UAnimMontage> ReloadAnimation;
|
||||
|
||||
/** The flat damage number of one bullet. */
|
||||
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 angle deviation of a bullet from the original ray. In degrees.*/
|
||||
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. */
|
||||
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))
|
||||
EAmmoType AmmoType;
|
||||
|
||||
/** The current number of ammo in the clip. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|Weapon", meta=(AllowPrivateAccess=true))
|
||||
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)
|
||||
TObjectPtr<ALMPlayer> Player;
|
||||
|
||||
/** The current state of the weapon. */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category="Legumix|Weapon")
|
||||
EWeaponState State;
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||
FDataTableRowHandle DataTableRow;
|
||||
|
||||
/** An optional socket to attach the weapon to. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||
FName WeaponSocket;
|
||||
|
||||
|
@ -10,15 +10,7 @@ struct FLMWeaponDataStructure : public FTableRowBase
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int MaxClipAmmo;
|
||||
|
||||
/** Mesh of the weapon display in the scene. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TObjectPtr<USkeletalMesh> MeshWeapon;
|
||||
|
||||
/** The animation blueprint to animate the mesh. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
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