Guest User

Untitled

a guest
Jan 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.02 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "GameFramework/CharacterMovementComponent.h"
  7. #include "MyCharacterMovementComponent.generated.h"
  8.  
  9. /**
  10.  *
  11.  */
  12. UCLASS()
  13. class MYPROJECT2_API UMyCharacterMovementComponent : public UCharacterMovementComponent
  14. {
  15.     GENERATED_BODY()
  16.         UMyCharacterMovementComponent(const FObjectInitializer& ObjectInitializer);
  17.  
  18.  
  19. public:
  20.  
  21.     /** The max Speed of sprint */
  22.     UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
  23.         float SprintSpeed;
  24.  
  25.     /** The acceleration of sprint */
  26.     UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
  27.         float SprintAccel;
  28.  
  29.     /** How long the sprint lasts */
  30.     UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
  31.         float SprintDurationSeconds;
  32.  
  33.     /** The max Speed of sprint*/
  34.     UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sprint")
  35.         float SprintRechargeSeconds;
  36.  
  37.     /**World time when sprint should end*/
  38.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
  39.         float SprintEndTime;
  40.  
  41.     /**World time when sprint will be recharged*/
  42.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
  43.         float SprintRechargeTime;
  44.  
  45.     /**True if sprint button has been pressed*/
  46.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
  47.         bool bPressedSprint;
  48.  
  49.     /**True if sprint button has been pressed*/
  50.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
  51.         bool bIsSprinting;
  52.  
  53.     /**True if we were sprinting in the last frame*/
  54.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprint")
  55.         bool bWasSprinting;
  56.  
  57.     /** Returns true if we can sprint*/
  58.     virtual bool CanSprint() const;
  59.  
  60.     /** Get our current max speed*/
  61.     virtual float GetMaxSpeed() const override;
  62.  
  63.     /**Get our current max acceleration*/
  64.     virtual float GetMaxAcceleration() const override;
  65.  
  66.     virtual void PerformAbilities(float DeltaTime);
  67.  
  68.     virtual void PerformMovement(float DeltaSeconds) override;
  69.  
  70.     virtual void UpdateFromCompressedFlags(uint8 Flags) override;
  71.  
  72.     virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
  73. };
  74.  
  75. class FSavedMove_Custom : public FSavedMove_Character
  76. {
  77. public:
  78.  
  79.     typedef FSavedMove_Character Super;
  80.  
  81.     bool bPressedSprint;
  82.  
  83.     float SavedSprintEndTime;
  84.     float SavedSprintRechargeTime;
  85.  
  86.     virtual void Clear() override;
  87.  
  88.     virtual uint8 GetCompressedFlags() const override;
  89.  
  90.     virtual bool CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* Character, float MaxDelta) const override;
  91.  
  92.     virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character & ClientData) override;
  93.  
  94.     virtual void PrepMoveFor(class ACharacter* Character) override;
  95.  
  96. };
  97.  
  98. class FNetworkPredictionData_Client_Custom : public FNetworkPredictionData_Client_Character
  99. {
  100. public:
  101.     typedef FNetworkPredictionData_Client_Character Super;
  102.  
  103.     virtual FSavedMovePtr AllocateNewMove() override;
  104.  
  105. };
Add Comment
Please, Sign In to add comment