第一次提交

This commit is contained in:
不明不惑
2026-03-03 01:23:02 +08:00
commit 3e434877e8
1053 changed files with 102411 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
// Copyright(c) Aurora Devs 2022-2025. All Rights Reserved.
#include "Input/UGC_CameraTurnRateModifier.h"
#include "EnhancedInputSubsystems.h"
#include "Camera/UGC_PlayerCameraManager.h"
#include "DrawDebugHelpers.h"
#include "Engine/Engine.h"
#include "GameFramework/PlayerController.h"
FInputActionValue UUGC_CameraTurnRateModifier::ModifyRaw_Implementation(const UEnhancedPlayerInput* PlayerInput, FInputActionValue CurrentValue, float DeltaTime)
{
EInputActionValueType ValueType = CurrentValue.GetValueType();
if (ValueType == EInputActionValueType::Boolean)
{
return CurrentValue;
}
if (!PlayerCameraManager)
{
if (!PlayerInput->GetOuterAPlayerController() || !PlayerInput->GetOuterAPlayerController()->PlayerCameraManager)
{
#if ENABLE_DRAW_DEBUG
// Debugging
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaTime, FColor::Red, FString::Printf(TEXT("UGC_CameraSlowDownInputModifier: Could not find Player Camera Manager to use Camera Slow Down constraint.")));
}
#endif
return CurrentValue;
}
AUGC_PlayerCameraManager* PCManager = Cast<AUGC_PlayerCameraManager>(PlayerInput->GetOuterAPlayerController()->PlayerCameraManager);
if (!PCManager)
{
#if ENABLE_DRAW_DEBUG
// Debugging
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaTime, FColor::Red, FString::Printf(TEXT("UGC_CameraSlowDownInputModifier: Player's Camera Manager does not inherit from UGC_PlayerCameraManager. Angle Constraint cannot be used.")));
}
#endif
return CurrentValue;
}
// Here we know that it's not null
PlayerCameraManager = PCManager;
}
return CurrentValue.Get<FVector>() * PlayerCameraManager->GetCameraTurnRate();
}

View File

@@ -0,0 +1,48 @@
// Copyright(c) Aurora Devs 2022-2025. All Rights Reserved.
#include "Input/UGC_InputAccelerationModifier.h"
#include "Curves/CurveFloat.h"
#include "DrawDebugHelpers.h"
#include "Engine/Engine.h"
FInputActionValue UUGC_InputAccelerationModifier::ModifyRaw_Implementation(const UEnhancedPlayerInput* PlayerInput, FInputActionValue CurrentValue, float DeltaTime)
{
EInputActionValueType ValueType = CurrentValue.GetValueType();
if (ValueType == EInputActionValueType::Boolean)
{
return CurrentValue;
}
if (CurrentValue.Get<FVector>() == FVector::ZeroVector || !AccelerationCurve)
{
Timer = 0.f;
return CurrentValue;
}
#if ENABLE_DRAW_DEBUG
// Debugging
if (GEngine)
{
bool bValidCurve = true;
FVector2D TimeRange;
AccelerationCurve->GetTimeRange(TimeRange.X, TimeRange.Y);
if (TimeRange.X != 0.f || TimeRange.Y != 1.f)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaTime, FColor::Red, FString::Printf(TEXT("UGC_InputAccelerationModifier: Given Curve's time range (X Axis) is not normalized i.e., between 0 and 1! Found: %s"), *TimeRange.ToString()));
bValidCurve = false;
}
if (!bValidCurve)
{
return CurrentValue;
}
}
#endif
Timer += DeltaTime;
float const ClampedTime = FMath::Clamp(AccelerationTime > 0.f ? Timer / AccelerationTime : 0.f, 0.f, 1.f);
return CurrentValue.Get<FVector>() * AccelerationCurve->GetFloatValue(ClampedTime);
}