56 lines
2.3 KiB
C++
56 lines
2.3 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UtilityLibrary.generated.h"
|
|
|
|
class UEnhancedInputLocalPlayerSubsystem;
|
|
|
|
/**
|
|
*
|
|
* UlxUtilityLibrary is for functions that are aren't particularly luprex-specific,
|
|
* but rather, are just generally-useful functionality that could help in any
|
|
* Unreal program.
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class INTEGRATION_API UlxUtilityLibrary : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
// If condition is false, quit the game, reporting an error message to the log.
|
|
//
|
|
UFUNCTION(BlueprintCallable, Category = "Luprex|Utility")
|
|
static void Assert(bool condition, const FString &ErrorMessage);
|
|
|
|
// Call a function by name, on any UObject. If the function doesn't exist, calls
|
|
// the fallback function instead. If that isn't found either, returns false.
|
|
//
|
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
|
|
static void CallFunctionByName(UObject *target, const FString &NamePart1, const FString &NamePart2, const FString &fallback, bool bFailIfNotFound = true);
|
|
|
|
// Get the axis-aligned bounding box of an actor.
|
|
//
|
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
|
|
static FBox GetActorBounds(const AActor *target, bool bOnlyCollidingComponents = false, bool bIncludeFromChildActors = false);
|
|
|
|
// Add movement input, using the yaw of the control rotation to find a rightward vector.
|
|
//
|
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Pawn|Input")
|
|
static void AddMovementInputRightward(APawn *target, double ScaleValue=1.0, bool Force=false);
|
|
|
|
// Add movement input, using the yaw of the control rotation to find a forward vector.
|
|
//
|
|
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Pawn|Input")
|
|
static void AddMovementInputForward(APawn *target, double ScaleValue=1.0, bool Force=false);
|
|
|
|
// Get the enhanced input local player subsystem from a controller. If the controller
|
|
// is not a player controller, or if it is a player controller but it doesn't have an
|
|
// enhanced input subsystem, return nullptr.
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Player Controller|Local Player Subsystems")
|
|
static UEnhancedInputLocalPlayerSubsystem *GetEnhancedInputLocalPlayerSubsystem(AController *Controller);
|
|
};
|