第一次提交

This commit is contained in:
不明不惑
2026-03-03 01:23:02 +08:00
commit 3e434877e8
1053 changed files with 102411 additions and 0 deletions

View File

@@ -0,0 +1,351 @@
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GCS_CombatStructLibrary.h"
#include "Runtime/Launch/Resources/Version.h"
#if ENGINE_MINOR_VERSION < 5
#include "InstancedStruct.h"
#else
#include "StructUtils/InstancedStruct.h"
#endif
#include "Collision/GCS_TraceStructLibrary.h"
#include "UObject/Object.h"
#include "GCS_BulletStructLibrary.generated.h"
class UGCS_AttackRequest_Bullet;
class UNiagaraSystem;
class AGCS_BulletInstance;
/**
* Base struct allow you to extend the bullet definition's fields using C++.
* 基础结构体允许你通过C++拓展子弹定义的字段。
*/
USTRUCT(BlueprintType, meta=(Hidden))
struct GENERICCOMBATSYSTEM_API FGCS_BulletDefinitionExtension
{
GENERATED_BODY()
};
/**
* Data structure defining bullet properties and behavior.
* 定义子弹属性和行为的数据结构。
*/
USTRUCT(BlueprintType, meta=(DisplayName="GCS Bullet Definition"))
struct GENERICCOMBATSYSTEM_API FGCS_BulletDefinition : public FTableRowBase
{
GENERATED_BODY()
/**
* The bullet actor class.
* 子弹Actor类。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common", meta=(AllowAbstract="false"))
TSoftClassPtr<AGCS_BulletInstance> BulletActorClass;
/**
* Duration for which the bullet exists (-1 for infinite).
* 子弹存在的持续时间(-1表示无限
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common")
float Duration{3.0};
/**
* Number of bullets fired at once.
* 一次性发射的子弹数量。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Launch Configuration", meta=(ClampMin=1, UIMin=1))
int32 BulletCount{1};
/**
* Yaw angle for bullet launch.
* 子弹发射的水平角。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Launch Configuration")
float LaunchAngle{0.0f};
/**
* Yaw angle interval between bullets.
* 子弹之间的水平角间隔。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Launch Configuration")
float LaunchAngleInterval{10.0f};
/**
* Pitch angle for bullet launch.
* 子弹发射的仰角。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Launch Configuration")
float LaunchElevationAngle{0.0f};
/**
* Distance at which bullet attenuation begins.
* 子弹开始衰减的距离。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float AttenuationRange{800.0f};
/**
* Gravity scale within the attenuation range.
* 衰减范围内的重力系数。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement")
float GravityScaleInRange{1.0f};
/**
* Gravity scale outside the attenuation range.
* 衰减范围外的重力系数。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement")
float GravityScaleOutRage{1.0f};
/**
* Initial hit radius for the bullet.
* 子弹的初始命中半径。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float InitialHitRadius{20.0f};
/**
* Final hit radius for the bullet (-1 to use initial radius).
* 子弹的最终命中半径(-1使用初始半径
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float FinalHitRadius{-1.0f};
/**
* Initial speed of the bullet.
* 子弹的初始速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float InitialSpeed{1500.0f};
/**
* Minimum speed of the bullet.
* 子弹的最小速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float MinSpeed{1500.0f};
/**
* Maximum speed of the bullet.
* 子弹的最大速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Movement", meta=(Units="cm"))
float MaxSpeed{1500.0f};
/**
* Handle to the attack definition for the bullet.
* 子弹的攻击定义句柄。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Attack", meta=(RowType="/Script/GenericCombatSystem.GCS_AttackDefinition"))
FDataTableRowHandle AttackDefinition;
/**
* Trace definitions for hit detection.
* 用于命中检测的碰撞检测定义。
* @note Overrides trace definitions in the bullet instance class.
* @注意 覆盖子弹实例类中的碰撞检测定义。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Trace")
TArray<FGCS_TraceDefinition> TraceDefinitions;
/**
* Visual effect for the bullet projectile (Niagara).
* 子弹的视觉效果Niagara
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
TSoftObjectPtr<UNiagaraSystem> ProjectileFX;
/**
* Visual effect for the bullet projectile (Cascade).
* 子弹的视觉效果Cascade
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
TSoftObjectPtr<UParticleSystem> ProjectileFX_Cascade;
/**
* Visual effect for bullet impact (Niagara).
* 子弹命中的视觉效果Niagara
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
TSoftObjectPtr<UNiagaraSystem> ImpactFX;
/**
* Visual effect for bullet impact (Cascade).
* 子弹命中的视觉效果Cascade
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
TSoftObjectPtr<UParticleSystem> ImpactFX_Cascade;
/**
* Sound effect for bullet impact.
* 子弹命中的音效。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="SFX")
TSoftObjectPtr<USoundBase> ImpactSFX;
/**
* Sound effect attached to the bullet projectile.
* 附着在子弹上的音效。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="SFX")
TSoftObjectPtr<USoundBase> ProjectileSFX;
/**
* Sound effect played once when the bullet spawns.
* 子弹生成时播放一次的音效。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="SFX")
TSoftObjectPtr<USoundBase> SpawnSFX;
/**
* Whether the bullet penetrates characters/pawns.
* 子弹是否穿透角色/Pawn。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Penetration")
bool bPenetrateCharacter{false};
/**
* Whether the bullet penetrates map geometry.
* 子弹是否穿透地图几何体。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Penetration")
bool bPenetrateMap{false};
/**
* Handle to the bullet definition to spawn on hit/expiration.
* 命中或失效时生成的子弹定义句柄。
* @note Cannot be the same as this bullet.
* @注意 不能与此子弹相同。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Configuration", meta=(RowType="/Script/GenericCombatSystem.GCS_BulletDefinition"))
FDataTableRowHandle HitBulletDefinition;
/**
* Condition for launching bullet chains.
* 子弹链的发射条件。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Configuration", meta=(Categories="GGF.Combat.Bullet.LaunchCond"))
FGameplayTag LaunchCondition{FGameplayTag::EmptyTag};
/**
* Native Instanced struct for extending the bullet definition.
* 实例化结构体用于扩充子弹定义的字段。
* @attention For C++ users only. 仅针对C++用户。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Extension")
TInstancedStruct<FGCS_BulletDefinitionExtension> NativeExtension;
/**
* Blueprint Instanced struct for extending the bullet definition.
* 实例化结构体用于扩充子弹定义的字段。
* @attention For blueprint users only. 仅针对蓝图用户。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Extension")
FInstancedStruct Extension;
/**
* Custom user settings for extending the bullet definition.
* 扩展子弹定义的自定义用户设置。
*/
UE_DEPRECATED(1.5, "Using extension field to add custom fields!")
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Deprecated", meta=(ForceInlineRow, BaseStruct = "/Script/GenericCombatSystem.GCS_UserSetting"))
TMap<FGameplayTag, FInstancedStruct> UserSettings;
/**
* Shares the hit history to sub bullet.(prevent repeat hit for whole bullet chains.)
*/
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Configuration",meta=(Categories="GGF.Combat.Bullet.LaunchCond"))
// bool bUseSharedHitList{true};
/**
* The amount of time between a bullet hits something and when it explodes.
*/
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Hit Configuration", meta=(Units="s", ClampMin=0))
// float ExplosionDelay{0.0};
// Emitter will be added in next version.
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Emitter", meta=(RowType="/Script/GenericCombatSystem.GCS_BulletDefinition"))
// FDataTableRowHandle EmitterBulletDefinition;
//
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Emitter")
// float EmitterInitialWaitTime{0};
//
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Emitter")
// float EmitterMinShootInterval{0};
//
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Emitter")
// float EmitterMaxShootInterval{0};
};
/**
* Parameters for spawning bullets.
* 子弹生成参数。
*/
USTRUCT(BlueprintType)
struct GENERICCOMBATSYSTEM_API FGCS_BulletSpawnParameters
{
GENERATED_BODY()
/**
* The owner of the bullet.
* 子弹的拥有者。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS")
TObjectPtr<AActor> Owner{nullptr};
/**
* Handle to the bullet definition.
* 子弹定义的句柄。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS", meta=(RowType="/Script/GenericCombatSystem.GCS_BulletDefinition"))
FDataTableRowHandle DefinitionHandle;
/**
* Transform for spawning the bullet.
* 子弹生成时的变换。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS")
FTransform SpawnTransform{FTransform::Identity};
/**
* The associated attack request.
* 关联的攻击请求。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS")
TObjectPtr<const UGCS_AttackRequest_Bullet> Request{nullptr};
/**
* Whether the bullet is locally predicted.
* 子弹是否为本地预测。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS")
bool bIsLocalPredicting{false};
/**
* IDs for locally predicted bullets.
* 本地预测子弹的ID。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS", meta=(DisplayName="Local Predicting Bullet Ids"))
TArray<FGuid> OverrideBulletIds;
/**
* ID of the parent bullet (for bullet chains).
* 父子弹的ID用于子弹链
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS")
FGuid ParentId;
/**
* Returns a debug string representation.
* 返回调试字符串表示。
* @return The debug string. 调试字符串。
*/
FString ToDebugString() const;
};