Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #pragma once
- #include "CoreMinimal.h"
- #include "GameFramework/CharacterMovementComponent.h"
- #include "MyCharacterMovementComponent.generated.h"
- /**
- *
- */
- UCLASS()
- class MYPROJECT2_API UMyCharacterMovementComponent : public UCharacterMovementComponent
- {
- GENERATED_BODY()
- UMyCharacterMovementComponent(const FObjectInitializer& ObjectInitializer);
- public:
- /** The max Speed of sprint */
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
- float SprintSpeed;
- /** The acceleration of sprint */
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
- float SprintAccel;
- /** How long the sprint lasts */
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
- float SprintDurationSeconds;
- /** The max Speed of sprint*/
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
- float SprintRechargeSeconds;
- /**World time when sprint should end*/
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
- float SprintEndTime;
- /**World time when sprint will be recharged*/
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
- float SprintRechargeTime;
- /**True if sprint button has been pressed*/
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
- bool bPressedSprint;
- /**True if sprint button has been pressed*/
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
- bool bIsSprinting;
- /**True if we were sprinting in the last frame*/
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
- bool bWasSprinting;
- /** Returns true if we can sprint*/
- virtual bool CanSprint() const;
- /** Get our current max speed*/
- virtual float GetMaxSpeed() const override;
- /**Get our current max acceleration*/
- virtual float GetMaxAcceleration() const override;
- virtual void PerformAbilities(float DeltaTime);
- virtual void PerformMovement(float DeltaSeconds) override;
- virtual void UpdateFromCompressedFlags(uint8 Flags) override;
- virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
- };
- class FSavedMove_Custom : public FSavedMove_Character
- {
- public:
- typedef FSavedMove_Character Super;
- bool bPressedSprint;
- float SavedSprintEndTime;
- float SavedSprintRechargeTime;
- virtual void Clear() override;
- virtual uint8 GetCompressedFlags() const override;
- virtual bool CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* Character, float MaxDelta) const override;
- virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character & ClientData) override;
- virtual void PrepMoveFor(class ACharacter* Character) override;
- };
- class FNetworkPredictionData_Client_Custom : public FNetworkPredictionData_Client_Character
- {
- public:
- typedef FNetworkPredictionData_Client_Character Super;
- virtual FSavedMovePtr AllocateNewMove() override;
- };
Add Comment
Please, Sign In to add comment