Пример #1
0
FGameplayAbilityTargetingLocationInfo UGameplayAbility::MakeTargetLocationInfoFromOwnerSkeletalMeshComponent(FName SocketName)
{
	FGameplayAbilityTargetingLocationInfo ReturnLocation;
	ReturnLocation.LocationType = EGameplayAbilityTargetingLocationType::SocketTransform;
	ReturnLocation.SourceComponent = GetActorInfo().AnimInstance.IsValid() ? GetActorInfo().AnimInstance.Get()->GetOwningComponent() : NULL;
	ReturnLocation.SourceSocketName = SocketName;
	return ReturnLocation;
}
Пример #2
0
FGameplayAbilityTargetingLocationInfo UGameplayAbility::MakeTargetLocationInfoFromOwnerActor()
{
	FGameplayAbilityTargetingLocationInfo ReturnLocation;
	ReturnLocation.LocationType = EGameplayAbilityTargetingLocationType::ActorTransform;
	ReturnLocation.SourceActor = GetActorInfo().AvatarActor.Get();
	return ReturnLocation;
}
Пример #3
0
bool UAIPerceptionComponent::HasActiveStimulus(const AActor& Source, FAISenseID Sense) const
{
    const FActorPerceptionInfo* Info = GetActorInfo(Source);
    return (Info
            && Info->LastSensedStimuli.IsValidIndex(Sense)
            && Info->LastSensedStimuli[Sense].WasSuccessfullySensed()
            && Info->LastSensedStimuli[Sense].GetAge() < FAIStimulus::NeverHappenedAge
            && (Info->LastSensedStimuli[Sense].GetAge() <= MaxActiveAge[Sense] || MaxActiveAge[Sense] == 0.f));
}
Пример #4
0
bool UAIPerceptionComponent::GetActorsPerception(AActor* Actor, FActorPerceptionBlueprintInfo& Info)
{
    bool bInfoFound = false;
    if (Actor && Actor->IsPendingKillPending())
    {
        const FActorPerceptionInfo* PerceivedInfo = GetActorInfo(*Actor);
        if (PerceivedInfo)
        {
            Info = FActorPerceptionBlueprintInfo(*PerceivedInfo);
            bInfoFound = true;
        }
    }

    return bInfoFound;
}
Пример #5
0
bool UAIPerceptionComponent::HasAnyActiveStimulus(const AActor& Source) const
{
    const FActorPerceptionInfo* Info = GetActorInfo(Source);
    if (Info == NULL)
    {
        return false;
    }

    for (uint32 SenseID = 0; SenseID < FAISenseID::GetSize(); ++SenseID)
    {
        if (Info->LastSensedStimuli[SenseID].WasSuccessfullySensed() &&
                Info->LastSensedStimuli[SenseID].GetAge() < FAIStimulus::NeverHappenedAge &&
                (Info->LastSensedStimuli[SenseID].GetAge() <= MaxActiveAge[SenseID] || MaxActiveAge[SenseID] == 0.f))
        {
            return true;
        }
    }

    return false;
}
Пример #6
0
float UAIPerceptionComponent::GetYoungestStimulusAge(const AActor& Source) const
{
    const FActorPerceptionInfo* Info = GetActorInfo(Source);
    if (Info == NULL)
    {
        return FAIStimulus::NeverHappenedAge;
    }

    float SmallestAge = FAIStimulus::NeverHappenedAge;
    for (int32 SenseID = 0; SenseID < Info->LastSensedStimuli.Num(); ++SenseID)
    {
        if (Info->LastSensedStimuli[SenseID].WasSuccessfullySensed())
        {
            float SenseAge = Info->LastSensedStimuli[SenseID].GetAge();
            if (SenseAge < SmallestAge)
            {
                SmallestAge = SenseAge;
            }
        }
    }

    return SmallestAge;
}
Пример #7
0
FVector UAIPerceptionComponent::GetActorLocation(const AActor& Actor) const
{
    // not that Actor == NULL is valid
    const FActorPerceptionInfo* ActorInfo = GetActorInfo(Actor);
    return ActorInfo ? ActorInfo->GetLastStimulusLocation() : FAISystem::InvalidLocation;
}