使用cursor修正代码

This commit is contained in:
2025-08-06 23:47:59 +08:00
parent 6b3260f35d
commit 94a19cbdf4
14 changed files with 735 additions and 251 deletions
+38 -23
View File
@@ -7,6 +7,7 @@
#include "BladeSmithWeaponComponent.generated.h"
class ABladeSmithCharacter;
class AIronBlock;
UCLASS(Blueprintable, BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BLADESMITH_API UBladeSmithWeaponComponent : public USkeletalMeshComponent
@@ -14,47 +15,61 @@ class BLADESMITH_API UBladeSmithWeaponComponent : public USkeletalMeshComponent
GENERATED_BODY()
public:
/** Projectile class to spawn */
UPROPERTY(EditDefaultsOnly, Category=Projectile)
TSubclassOf<class ABladeSmithProjectile> ProjectileClass;
/** Sound to play each time we fire */
/** 锤击音效 */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
USoundBase* FireSound;
USoundBase* HammerHitSound;
/** AnimMontage to play each time we fire */
/** 锤击动画 */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gameplay)
UAnimMontage* FireAnimation;
UAnimMontage* HammerSwingAnimation;
/** Gun muzzle's offset from the characters location */
/** 锤子头部偏移 */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
FVector MuzzleOffset;
FVector HammerHeadOffset;
/** MappingContext */
/** 锤击力度 */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
float HammerForce = 1000.0f;
/** 锤击范围 */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
float HammerRange = 200.0f;
/** 输入映射上下文 */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
class UInputMappingContext* FireMappingContext;
class UInputMappingContext* HammerMappingContext;
/** Fire Input Action */
/** 锤击输入动作 */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
class UInputAction* FireAction;
class UInputAction* HammerAction;
/** Sets default values for this component's properties */
/** 设置默认值 */
UBladeSmithWeaponComponent();
/** Attaches the actor to a FirstPersonCharacter */
UFUNCTION(BlueprintCallable, Category="Weapon")
bool AttachWeapon(ABladeSmithCharacter* TargetCharacter);
/** 将锤子附加到角色 */
UFUNCTION(BlueprintCallable, Category="Hammer")
bool AttachHammer(ABladeSmithCharacter* TargetCharacter);
/** Make the weapon Fire a Projectile */
UFUNCTION(BlueprintCallable, Category="Weapon")
void Fire();
/** 执行锤击 */
UFUNCTION(BlueprintCallable, Category="Hammer")
void SwingHammer();
/** 获取锤子头部位置 */
UFUNCTION(BlueprintCallable, Category="Hammer")
FVector GetHammerHeadLocation() const;
protected:
/** Ends gameplay for this component. */
/** 组件结束游戏时的处理 */
UFUNCTION()
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
private:
/** The Character holding this weapon*/
/** 持有此锤子的角色 */
ABladeSmithCharacter* Character;
/** 执行锤击检测 */
void PerformHammerHit();
/** 处理与铁块的碰撞 */
void HandleIronBlockHit(AIronBlock* IronBlock, const FHitResult& HitResult);
};