Files
ProjectEleri/Source/ProjectEleri/Components/EleriMovementComponent.cpp

38 lines
885 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "EleriMovementComponent.h"
#include "Components/StatForgeComponent.h"
#include "Data/StatDefinitions.h"
#include "Helpers/StatForgeFunctionLibrary.h"
#include "System/EleriGameplayTags.h"
#include "System/MainBlueprintFunctionLibrary.h"
float UEleriMovementComponent::GetMaxSpeed() const
{
if (StatForgeComponent->GetGameplayTags().HasTagExact(CharacterState::MovementDisabled))
{
return 0.f;
}
const float BaseSpeed = Super::GetMaxSpeed();
if (StatForgeComponent)
{
const float Multi = StatForgeComponent->GetStatValue(FStat::MovementSpeedMultiplier);
return BaseSpeed * Multi;
}
return BaseSpeed;
}
void UEleriMovementComponent::BeginPlay()
{
Super::BeginPlay();
StatForgeComponent = UMainBlueprintFunctionLibrary::GetStatForgeComponentFromActor(GetOwner());
}