#pragma once #include "CoreMinimal.h" #include "GameFramework/CharacterMovementComponent.h" #include "DescentCharacterMovement.generated.h" /** Custom movement modes of the character (MOVE_Custom). */ namespace EDescentCustomMove { enum Type : uint8 { None = 0, Swim = 1 }; } /** * The character's movement (DESIGN_UE.md sections 3.1, 5.2, 5.3): walking with v2's velocity response and the settings that make it * ride the moving carrier, and swimming as a custom mode (PhysCustom): velocity response 2.2, slow sink, the Shear, a sweep so Tender * collision boxes block, then push-outs against the density field, the carrier hull and Tenders. No position clamp (requirement U7). */ UCLASS() class THEDESCENT_API UDescentCharacterMovement : public UCharacterMovementComponent { GENERATED_BODY() public: UDescentCharacterMovement(const FObjectInitializer& ObjectInitializer); virtual void CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration) override; virtual void PhysCustom(float DeltaTime, int32 Iterations) override; bool IsSwimMode() const { return MovementMode == MOVE_Custom && CustomMovementMode == EDescentCustomMove::Swim; } void StartSwim(); /** Where the swimmer wants to go this tick (world, length <= 1) and whether it sprints; written by the character from the intent. */ FVector SwimWish = FVector::ZeroVector; bool bSwimSprint = false; /** The speed penalty of hunger (1 until M8). */ double HungerMul = 1.0; /** Rock contacts of the last swim step (state dump). */ int32 SwimContacts = 0; };