UE学习日志#8 GAS--ASC源码简要分析6 GameplayEffects: Primary outward facing API for other systems P2

注: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值