注:1.这个分类是按照源码里的注释分类的
2.本篇是通读并给出一些注释形式的,并不涉及结构性的分析
3.看之前要对UE的GAS系统的定义有初步了解
4.因为都是接口函数,有些没细看的研究那一部分的时候会细看
8 OnPredictiveGameplayCueCatchup
Call预测性添加的GC,移除标签并尝试InvokeGC事件ByTag
/** Called for predictively added gameplay cue. Needs to remove tag count and possible invoke OnRemove event if misprediction */
virtual void OnPredictiveGameplayCueCatchup(FGameplayTag Tag);
实现:
void UAbilitySystemComponent::OnPredictiveGameplayCueCatchup(FGameplayTag Tag)
{
// Remove it
RemoveLooseGameplayTag(Tag);
if (HasMatchingGameplayTag(Tag) == 0)
{
// Invoke Removed event if we no longer have this tag (probably a mispredict)
InvokeGameplayCueEvent(Tag, EGameplayCueEvent::Removed);
}
}
9 GetGameplayEffectDuration
声明:
输入Handle,返回
/** Returns the total duration of a gameplay effect */
float GetGameplayEffectDuration(FActiveGameplayEffectHandle Handle) const;
实现:
调用FActiveGameplayEffectsContainer类型的GetGameplayEffectStartTimeAndDuration
float UAbilitySystemComponent::GetGameplayEffectDuration(FActiveGameplayEffectHandle Handle) const
{
float StartEffectTime = 0.0f;
float Duration = 0.0f;
ActiveGameplayEffects.GetGameplayEffectStartTimeAndDuration(Handle, StartEffectTime, Duration);
return Duration;
}
到了GetGameplayEffectStartTimeAndDuration中匹配Handle,然后调用下边这个获取
EffectStartTime = ActiveEffect.StartWorldTime;
EffectDuration = ActiveEffect.GetDuration();
10 RecomputeGameplayEffectStartTimes
通过游戏状态同步服务器时间的时候调用,来保持冷却时间与服务器的同步
/** Called whenever the server time replicates via the game state to keep our cooldown timers in sync with the server */
virtual void RecomputeGameplayEffectStartTimes(const float WorldTime, const float ServerWorldTime);
调用FActiveGameplayEffectsContainer类型的Recomput

最低0.47元/天 解锁文章
3万+

被折叠的 条评论
为什么被折叠?



