예제 #1
0
void FGameplayCueHandler::GameplayCueActivated(const FGameplayTagContainer& GameplayCueTags, float NormalizedMagnitude, const FGameplayEffectContextHandle& EffectContext)
{
	check(Owner);
	bool InstigatorLocal = EffectContext.IsLocallyControlled();
	bool TargetLocal = OwnerIsLocallyControlled();
	
	for (auto TagIt = GameplayCueTags.CreateConstIterator(); TagIt; ++TagIt)
	{
		if (FGameplayCueViewInfo* View = GetBestMatchingView(EGameplayCueEvent::OnActive, *TagIt, InstigatorLocal, TargetLocal))
		{
			View->SpawnViewEffects(Owner, NULL, EffectContext);
		}

		FName MatchedTag;
		UFunction *Func = UAbilitySystemGlobals::Get().GetGameplayCueFunction(*TagIt, Owner->GetClass(), MatchedTag);
		if (Func)
		{
			FGameplayCueParameters Params;
			Params.NormalizedMagnitude = NormalizedMagnitude;
			Params.EffectContext = EffectContext;

			IGameplayCueInterface::DispatchBlueprintCustomHandler(Owner, Func, EGameplayCueEvent::OnActive, Params);
		}
	}
}
예제 #2
0
void FGameplayCueHandler::GameplayCueExecuted(const FGameplayTagContainer& GameplayCueTags, float NormalizedMagnitude, const FGameplayEffectContextHandle& EffectContext)
{
	check(Owner);
	bool InstigatorLocal = EffectContext.IsLocallyControlled();
	bool TargetLocal = OwnerIsLocallyControlled();

	for (auto TagIt = GameplayCueTags.CreateConstIterator(); TagIt; ++TagIt)
	{
		if (FGameplayCueViewInfo* View = GetBestMatchingView(EGameplayCueEvent::Executed, *TagIt, InstigatorLocal, TargetLocal))
		{
			View->SpawnViewEffects(Owner, NULL, EffectContext);
		}
	}
}
예제 #3
0
void FGameplayCueHandler::GameplayCueAdded(const FGameplayTagContainer& GameplayCueTags, float NormalizedMagnitude, const FGameplayEffectContextHandle& EffectContext)
{
	check(Owner);
	bool InstigatorLocal = EffectContext.IsLocallyControlled();
	bool TargetLocal = OwnerIsLocallyControlled();

	for (auto TagIt = GameplayCueTags.CreateConstIterator(); TagIt; ++TagIt)
	{
		TArray<TSharedPtr<FGameplayCueViewEffects> > &Effects = SpawnedViewEffects.FindOrAdd(*TagIt);

		// Clear old effects if they existed? This will vary case to case. Removing old effects is the easiest approach
		ClearEffects(Effects);
		check(Effects.Num() == 0);

		if (FGameplayCueViewInfo * View = GetBestMatchingView(EGameplayCueEvent::WhileActive, *TagIt, InstigatorLocal, TargetLocal))
		{
			TSharedPtr<FGameplayCueViewEffects> SpawnedEffects = View->SpawnViewEffects(Owner, &SpawnedObjects, EffectContext);
			Effects.Add(SpawnedEffects);
		}
	}
}
bool UAbilitySystemBlueprintLibrary::EffectContextIsInstigatorLocallyControlled(FGameplayEffectContextHandle EffectContext)
{
	return EffectContext.IsLocallyControlled();
}