Init
This commit is contained in:
18
03-UnrealEngine/Gameplay/GAS/(15)GAS 网络与预测.md
Normal file
18
03-UnrealEngine/Gameplay/GAS/(15)GAS 网络与预测.md
Normal file
@@ -0,0 +1,18 @@
|
||||
## FScopedPredictionWindow、ServerSetReplicatedEvent、ConsumeGenericReplicatedEvent
|
||||
```
|
||||
FScopedPredictionWindow ScopedPrediction(AbilitySystemComponent, IsPredictingClient());
|
||||
|
||||
//Ability是否具有本地预测能力
|
||||
if (IsPredictingClient())
|
||||
{
|
||||
// Tell the server about this
|
||||
AbilitySystemComponent->ServerSetReplicatedEvent(EAbilityGenericReplicatedEvent::InputPressed, GetAbilitySpecHandle(), GetActivationPredictionKey(), AbilitySystemComponent->ScopedPredictionKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
AbilitySystemComponent->ConsumeGenericReplicatedEvent(EAbilityGenericReplicatedEvent::InputPressed, GetAbilitySpecHandle(), GetActivationPredictionKey());
|
||||
}
|
||||
```
|
||||
|
||||
## 预测
|
||||

|
Reference in New Issue
Block a user