RealtimeStyleTransferRuntime/Plugins/GameFeatures/TopDownArena/Source/TopDownArenaRuntime/Private/TopDownArenaMovementCompone...

37 lines
1.0 KiB
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "TopDownArenaMovementComponent.h"
2022-09-13 07:18:28 +00:00
#include "AbilitySystemComponent.h"
#include "Containers/EnumAsByte.h"
#include "Engine/EngineTypes.h"
2022-05-23 18:41:30 +00:00
#include "GameplayAbilities/Public/AbilitySystemGlobals.h"
2022-09-13 07:18:28 +00:00
#include "NativeGameplayTags.h"
2022-05-23 18:41:30 +00:00
#include "TopDownArenaAttributeSet.h"
UTopDownArenaMovementComponent::UTopDownArenaMovementComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
float UTopDownArenaMovementComponent::GetMaxSpeed() const
{
if (UAbilitySystemComponent* ASC = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetOwner()))
{
if (MovementMode == MOVE_Walking)
{
if (ASC->HasMatchingGameplayTag(TAG_Gameplay_MovementStopped))
{
return 0;
}
const float MaxSpeedFromAttribute = ASC->GetNumericAttribute(UTopDownArenaAttributeSet::GetMovementSpeedAttribute());
if (MaxSpeedFromAttribute > 0.0f)
{
return MaxSpeedFromAttribute;
}
}
}
return Super::GetMaxSpeed();
}