N0B0DY1x

PlayerCharacter.h - Replicated

Dec 2nd, 2020
463
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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/Character.h"
  7. #include "Camera/CameraComponent.h"
  8. #include "PlayerCharacter.generated.h"
  9.  
  10. UCLASS()
  11. class GAMEPROJECT_API APlayerCharacter : public ACharacter
  12. {
  13.     GENERATED_BODY()
  14.  
  15.     /** Camera boom positioning the camera behind the character */
  16.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  17.     class USpringArmComponent* CameraBoom;
  18.  
  19.     /** Follow camera */
  20.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  21.     class UCameraComponent* TPSCamera;
  22.  
  23.     /** FPS camera */
  24.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
  25.     class UCameraComponent* FPSCamera;
  26.  
  27. public:
  28.     // Sets default values for this character's properties
  29.     APlayerCharacter();
  30.  
  31. protected:
  32.     // Called when the game starts or when spawned
  33.     virtual void BeginPlay() override;
  34.  
  35.     UPROPERTY(ReplicatedUsing = OnRep_ChangeView)
  36.     bool bThirdPerson;
  37.  
  38. public:
  39.     // Called to bind functionality to input
  40.     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
  41.  
  42.     UFUNCTION()
  43.     void MoveForward(const float Value);
  44.  
  45.     UFUNCTION()
  46.     void MoveRight(const float Value);
  47.  
  48.     UFUNCTION()
  49.     void StartJump();
  50.  
  51.     UFUNCTION()
  52.     void StopJump();
  53.  
  54.     UFUNCTION()
  55.     void ChangeView();
  56.  
  57.     UFUNCTION(Server, Reliable)
  58.     void Server_SetThirdParty(bool bThirdParty);
  59.  
  60.     UFUNCTION()
  61.     virtual void OnRep_ChangeView();
  62. };
  63.  
RAW Paste Data