第一次提交

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,30 @@
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "GMS_ZiplineInterface.generated.h"
// This class does not need to be modified.
UINTERFACE()
class GENERICMOVEMENTSYSTEM_API UGMS_ZiplineInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class GENERICMOVEMENTSYSTEM_API IGMS_ZiplineInterface
{
GENERATED_BODY()
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Zipline")
USceneComponent* GetStartComponent();
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Zipline")
USceneComponent* GetEndComponent();
};

View File

@@ -0,0 +1,51 @@
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Runtime/Launch/Resources/Version.h"
#include "GMS_ZipliningMode.h"
#include "MovementModeTransition.h"
#include "GMS_ZiplineModeTransition.generated.h"
/**
* Transition that handles starting ziplining based on input. Character must be airborne to catch the
* zipline, regardless of input.
*/
UCLASS(Blueprintable, BlueprintType)
class UGMS_ZiplineStartTransition : public UBaseMovementModeTransition
{
GENERATED_UCLASS_BODY()
#if ENGINE_MINOR_VERSION >= 6
virtual FTransitionEvalResult Evaluate_Implementation(const FSimulationTickParams& Params) const override;
#else
virtual FTransitionEvalResult OnEvaluate(const FSimulationTickParams& Params) const override;
#endif
UPROPERTY(EditAnywhere, Category = "Ziplining")
FName ZipliningModeName = ExtendedModeNames::Ziplining;
UPROPERTY(EditAnywhere, Category = "Ziplining")
FGameplayTag ZipliningInputTag;
};
/**
* Transition that handles exiting ziplining based on input
*/
UCLASS(Blueprintable, BlueprintType)
class UGMS_ZiplineEndTransition : public UBaseMovementModeTransition
{
GENERATED_UCLASS_BODY()
#if ENGINE_MINOR_VERSION >= 6
virtual FTransitionEvalResult Evaluate_Implementation(const FSimulationTickParams& Params) const override;
virtual void Trigger_Implementation(const FSimulationTickParams& Params) override;
#else
virtual FTransitionEvalResult OnEvaluate(const FSimulationTickParams& Params) const override;
virtual void OnTrigger(const FSimulationTickParams& Params) override;
#endif
// Mode to enter when exiting the zipline
UPROPERTY(EditAnywhere, Category = "Ziplining")
FName AutoExitToMode = DefaultModeNames::Falling;
};

View File

@@ -0,0 +1,55 @@
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Runtime/Launch/Resources/Version.h"
#include "MovementMode.h"
#include "GMS_ZipliningMode.generated.h"
namespace ExtendedModeNames
{
const FName Ziplining = TEXT("Ziplining");
}
// ZipliningMode: movement mode that traverses an actor implementing the IZipline interface
UCLASS(Blueprintable, BlueprintType)
class UGMS_ZipliningMode : public UBaseMovementMode
{
GENERATED_UCLASS_BODY()
#if ENGINE_MINOR_VERSION >=6
virtual void GenerateMove_Implementation(const FMoverTickStartData& StartState, const FMoverTimeStep& TimeStep, FProposedMove& OutProposedMove) const override;
virtual void SimulationTick_Implementation(const FSimulationTickParams& Params, FMoverTickEndData& OutputState) override;
#else
virtual void OnGenerateMove(const FMoverTickStartData& StartState, const FMoverTimeStep& TimeStep, FProposedMove& OutProposedMove) const override;
virtual void OnSimulationTick(const FSimulationTickParams& Params, FMoverTickEndData& OutputState) override;
#endif
// Maximum speed
UPROPERTY(EditAnywhere, Category = "Ziplining", meta = (ClampMin = "1", UIMin = "1", ForceUnits = "cm/s"))
float MaxSpeed = 1000.0f;
};
// Data block containing ziplining state info, used while ZipliningMode is active
USTRUCT()
struct FGMS_ZipliningState : public FMoverDataStructBase
{
GENERATED_USTRUCT_BODY()
TObjectPtr<AActor> ZiplineActor;
bool bIsMovingAtoB;
FGMS_ZipliningState()
: bIsMovingAtoB(true)
{
}
virtual FMoverDataStructBase* Clone() const override;
virtual bool NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess) override;
virtual UScriptStruct* GetScriptStruct() const override { return StaticStruct(); }
virtual void ToString(FAnsiStringBuilderBase& Out) const override;
virtual bool ShouldReconcile(const FMoverDataStructBase& AuthorityState) const override;
virtual void Interpolate(const FMoverDataStructBase& From, const FMoverDataStructBase& To, float Pct) override;
};