LyraLog14 GAS 死亡重生落地

蒙太奇+布娃娃+特效

把地上那个扣血板挪过来,算了,发现是个周期性技能,一次性伤害还没写完

结果有bug需要一个单机的伤害方式,还是挪过来吧

确实打死了,但是打死还在原地,没反应,Cue欠的太多了

检查重生技能是有的。体验->AddAbility->GA_AutoRespawn

检查重生组件是有的。体验->AddComp->GameState加组件 B_DefaultSpawningRules

在B_Hero_Default

Random一个蒙太奇

但是这样播放完成后,又恢复站立了

加布娃娃

void AEqZeroCharacter::StartRagdoll()
{
    if (USkeletalMeshComponent* MeshComp = GetMesh())
    {
        // 获取速度用于冲量
        FVector LastVelocity = FVector::ZeroVector;
        if (const UCharacterMovementComponent* MoveComp = GetCharacterMovement())
        {
            LastVelocity = MoveComp->GetLastUpdateVelocity();
        }

        MeshComp->SetCollisionProfileName(FName("Ragdoll"));
        MeshComp->SetAllBodiesBelowSimulatePhysics(RagdollImpulseBone, true, true);

        FVector ImpulseDir = LastVelocity.GetSafeNormal(0.0001f);
        FVector Impulse = LastVelocity + (ImpulseDir * RagdollImpulseStrength);
        MeshComp->AddImpulse(Impulse, NAME_None, true);
    }
}

加布娃娃发现会抖动,检查后,发现原版也会,他只是有cue的消融特效。所以看不出来

void UEqZeroGameplayAbility_Death::ActivateAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const FGameplayEventData* TriggerEventData)
{
    // ...

    if (TriggerEventData && DeathGameplayCueTag.IsValid())
    {
        FGameplayCueParameters CueParams;
        CueParams.RawMagnitude = TriggerEventData->EventMagnitude;
        CueParams.EffectContext = TriggerEventData->ContextHandle;
        CueParams.MatchedTagName = TriggerEventData->EventTag;
        CueParams.AggregatedSourceTags = TriggerEventData->InstigatorTags;
        CueParams.AggregatedTargetTags = TriggerEventData->TargetTags;
        K2_ExecuteGameplayCueWithParams(DeathGameplayCueTag, CueParams);
    }

    // ...
}

给死亡技能的激活添加上这一段

/ShooterCore/GameplayCues/GCNL_Death.GCNL_Death

我们准备做这个Cue 父类是 GameplayCueNotify_BurstLatent

GameplayCueNotify_Static 不实例化对象,直接触发一次性效果(如播放粒子、声音)。轻量,性能好。 一次性“爆发”效果,例如技能释放瞬间的闪光或音效。
GameplayCueNotify_Burst 继承自 Static,专门用于一次性爆发效果。 命中瞬间的特效或音效。
GameplayCueNotify_HitImpact 也是 Static 的派生类,专门处理命中效果,通常带有位置和命中信息。 武器击中、子弹命中时的火花、血液效果。
GameplayCueNotify_Actor 会生成一个 Actor,能在场景中存在一段时间,支持复杂的粒子或动画。需要手动销毁或设置自动销毁。 持续存在的效果,例如火焰喷射、护盾环绕。
GameplayCueNotify_Looping 用于循环播放的效果,直到被移除。 Buff、持续技能、环境特效(如风暴、光环)。
GameplayCueNotify_BurstLatent 类似 Burst,但支持延迟或异步触发。 技能释放后延迟爆炸、逐步展开的特效。

死亡技能的配置,新加的这个 DeathGameplayCueTag

死亡Cue的配置,TAG,Num Preallocated Instance

另外需要能成功加载这个Cue,需要ini配置

[/Script/GameplayAbilities.AbilitySystemGlobals]
AbilitySystemGlobalsClassName=/Script/EqZeroGame.EqZeroAbilitySystemGlobals
+GameplayCueNotifyPaths="/Game/GameplayCues"
+GameplayCueNotifyPaths="/EqZeroCore/GameplayCues"

但是这里依赖GameFeature看起来不太对

一种是在GameFeatureAction里面写代码

CueManager里面 GCM->AddGameplayCueNotifyPath

但是Lyra没有怎么做。通过 ULyraGameFeaturePolicy 这个 policy解耦

所以我们需要配置 default game ini

[/Script/GameFeatures.GameFeaturesSubsystemSettings]
GameFeaturesManagerClassName=/Script/EqZeroGame.EqZeroGameFeaturePolicy

这个例子特效就OK了,然后是消融效果

我们这个主要是设置材质参数,

还有一张timeline的图没截。。。

特效搞定了,重生呢?

/EqZeroCore/Experiences/B_EqZGame_Elimination.B_EqZGame_Elimination 体检

/EqZeroCore/Elimination/AbilitySet_Elimination.AbilitySet_Elimination 技能集合

里面有一个重生技能,调用到game mode

然后重新到player start

重生后死不了了,死亡技能没有触发

按回车左边那个“ ' ”

gdt.ToggleCategory 3

gdt.EnableCategoryName Abilities 1

【死亡技能8s后结束技能,重生技能是5s,如果太快的又死了,就会出现死不了的问题】

<-发现这是我的BUG,不是读秒的问题。

重生流程可以在 AEqZeroGameMode::ChoosePlayerStart_Implementation 这里打断点

后续可以加一些,死亡和重生的UI了。TODO

上一篇
下一篇