feat(gas): Batch 2 - Vertical slice Dash client (input bind + assets)
ZeusCharacter: - DashAction UPROPERTY + load /Game/Input/Actions/IA_Dash.IA_Dash no ctor. - SetupPlayerInputComponent: BindAction(DashAction, Triggered) -> OnDashTriggered. - OnDashTriggered: resolve UZeusGASComponent via PlayerState -> chama RequestActivateAbilityByTag(Zeus.Ability.Movement.Dash). Bridge envia C_ABILITY_TRY_ACTIVATE pro server (handle, tagHash) e o ASC local executa ActivateAbility (LaunchCharacter) quando server confirma S_ABILITY_ACTIVATED. Assets (criados via MCP): - DT_Abilities (/Game/ZMMO/Data/Abilities/) — row "Zeus.Ability.Movement.Dash" apontando pro BP_GA_Dash_C. Row name = tag canonica (hash bate com server). - BP_GA_Dash (/Game/ZMMO/GAS/Abilities/) — parent UZeusGameplayAbility_Dash. - IA_Dash (/Game/Input/Actions/) — Boolean InputAction. - IMC_Default — bind LeftShift -> IA_Dash com trigger Pressed (13a mapping). Fluxo completo (apos rebuild + server na branch GameplayAbilitySystem): LShift -> OnDashTriggered -> RequestActivateAbilityByTag -> C_ABILITY_TRY_ACTIVATE -> server valida cost SP/cooldown -> S_ABILITY_ACTIVATED + S_ATTRIBUTE_HP_SP_UPDATE (-10 SP) -> ASC.TryActivateAbility(local) -> BP_GA_Dash::ActivateAbility -> LaunchCharacter(forward * 2400 cm/s) + HUD SP cai 10 + cooldown 3s. Branch GameplayAbilitySystem (criada a partir do main pro escopo GAS). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
BIN
Content/Input/Actions/IA_Dash.uasset
Normal file
BIN
Content/Input/Actions/IA_Dash.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/ZMMO/Data/Abilities/DT_Abilities.uasset
Normal file
BIN
Content/ZMMO/Data/Abilities/DT_Abilities.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/GAS/Abilities/BP_GA_Dash.uasset
Normal file
BIN
Content/ZMMO/GAS/Abilities/BP_GA_Dash.uasset
Normal file
Binary file not shown.
@@ -17,6 +17,8 @@
|
||||
#include "Subsystems/WorldSubsystem.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "ZMMO.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "GameplayTagsManager.h"
|
||||
#include "ZeusGASComponent.h"
|
||||
#include "ZeusPlayerState.h"
|
||||
#include "ZeusWorldSubsystem.h"
|
||||
@@ -101,11 +103,14 @@ AZeusCharacter::AZeusCharacter()
|
||||
TEXT("/Game/Input/Actions/IA_MouseLook.IA_MouseLook"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> JumpActionAsset(
|
||||
TEXT("/Game/Input/Actions/IA_Jump.IA_Jump"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> DashActionAsset(
|
||||
TEXT("/Game/Input/Actions/IA_Dash.IA_Dash"));
|
||||
|
||||
if (MoveActionAsset.Succeeded()) { MoveAction = MoveActionAsset.Object; }
|
||||
if (LookActionAsset.Succeeded()) { LookAction = LookActionAsset.Object; }
|
||||
if (MouseLookActionAsset.Succeeded()) { MouseLookAction = MouseLookActionAsset.Object; }
|
||||
if (JumpActionAsset.Succeeded()) { JumpAction = JumpActionAsset.Object; }
|
||||
if (DashActionAsset.Succeeded()) { DashAction = DashActionAsset.Object; }
|
||||
}
|
||||
|
||||
void AZeusCharacter::BeginPlay()
|
||||
@@ -166,6 +171,11 @@ void AZeusCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompo
|
||||
|
||||
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AZeusCharacter::Look);
|
||||
EnhancedInputComponent->BindAction(MouseLookAction, ETriggerEvent::Triggered, this, &AZeusCharacter::Look);
|
||||
|
||||
if (DashAction)
|
||||
{
|
||||
EnhancedInputComponent->BindAction(DashAction, ETriggerEvent::Triggered, this, &AZeusCharacter::OnDashTriggered);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -203,6 +213,40 @@ void AZeusCharacter::OnJumpReleased()
|
||||
DoJumpEnd();
|
||||
}
|
||||
|
||||
void AZeusCharacter::OnDashTriggered()
|
||||
{
|
||||
// Resolve UZeusGASComponent do PlayerState. Component vive la' via
|
||||
// AZeusPlayerState Component Registry (config-driven). Sem el, ASC ausente
|
||||
// e RequestActivateAbilityByTag falha — log warning.
|
||||
const APlayerState* PS = GetPlayerState();
|
||||
if (!PS)
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("OnDashTriggered: PlayerState nullptr — ignorado"));
|
||||
return;
|
||||
}
|
||||
UZeusGASComponent* Comp = PS->FindComponentByClass<UZeusGASComponent>();
|
||||
if (!Comp)
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("OnDashTriggered: UZeusGASComponent nao achado"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Tag canonica casa com row do DT + JSON do server. Hash FNV calculado
|
||||
// dentro do componente (RequestActivateAbilityByTag).
|
||||
const FGameplayTag DashTag = UGameplayTagsManager::Get().RequestGameplayTag(
|
||||
FName(TEXT("Zeus.Ability.Movement.Dash")));
|
||||
if (!DashTag.IsValid())
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning,
|
||||
TEXT("OnDashTriggered: tag Zeus.Ability.Movement.Dash nao registrada no cliente"));
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bSent = Comp->RequestActivateAbilityByTag(DashTag);
|
||||
UE_LOG(LogZeusPlayer, Log, TEXT("OnDashTriggered -> RequestActivateAbilityByTag = %s"),
|
||||
bSent ? TEXT("OK (C_ABILITY_TRY_ACTIVATE enviado)") : TEXT("FALHOU"));
|
||||
}
|
||||
|
||||
void AZeusCharacter::DoMove(const float Right, const float Forward)
|
||||
{
|
||||
PendingMoveRight = FMath::Clamp(Right, -1.0f, 1.0f);
|
||||
|
||||
@@ -62,6 +62,11 @@ protected:
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
UInputAction* MouseLookAction;
|
||||
|
||||
/// IA_Dash — dispara C_ABILITY_TRY_ACTIVATE pra Zeus.Ability.Movement.Dash
|
||||
/// via UZeusGASComponent. Bind padrao no IMC_Default: LeftShift -> Pressed.
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
UInputAction* DashAction;
|
||||
|
||||
/** Cadencia de envio dos pacotes `C_INPUT_AXIS` (Hz). */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Zeus|Networking", meta = (ClampMin = "1", ClampMax = "120"))
|
||||
int32 InputSendRateHz = 30;
|
||||
@@ -104,6 +109,11 @@ protected:
|
||||
void OnJumpPressed();
|
||||
void OnJumpReleased();
|
||||
|
||||
/// IA_Dash Triggered -> resolve UZeusGASComponent do PlayerState e chama
|
||||
/// RequestActivateAbilityByTag("Zeus.Ability.Movement.Dash"). Server valida
|
||||
/// + responde S_ABILITY_ACTIVATED (HP/SP atualizado, montage roda local).
|
||||
void OnDashTriggered();
|
||||
|
||||
public:
|
||||
/** Wrappers expostos a Blueprint (UI / mobile / automation). */
|
||||
UFUNCTION(BlueprintCallable, Category = "Input")
|
||||
|
||||
Reference in New Issue
Block a user