Advertisement
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/Pawn.h"
- #include "Components/StaticMeshComponent.h"
- #include "GameFramework/SpringArmComponent.h"
- #include "Camera/CameraComponent.h"
- #include "Net/UnrealNetwork.h"
- #include "ClientPawn.generated.h"
- UCLASS()
- class NETPROJECT_API AClientPawn : public APawn
- {
- GENERATED_BODY()
- public:
- // Sets default values for this pawn's properties
- AClientPawn();
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Meshes")
- UStaticMeshComponent* mainMesh;
- UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Camera")
- USpringArmComponent* springArm;
- UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Camera")
- UCameraComponent* camera;
- UPROPERTY()
- FVector CameraInput;
- UPROPERTY()
- FVector MovementInput;
- UPROPERTY()
- FVector ClientLocation;
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
- float moveForward;
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
- float moveRight;
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
- FVector ActorServerLocation;
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
- FRotator ActorServerRotation;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Editable Values")
- float turnSpeed;
- UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = "Editable Values")
- float walkSpeed;
- UFUNCTION(Reliable, Server)
- void MoveRightServer(float Value);
- UFUNCTION(Reliable, Server)
- void MoveForwardServer(float Value);
- UFUNCTION(Reliable, Server)
- void ChangeWalkSpeed();
- UFUNCTION()
- void CameraMovement(float SensitivityX, float SensitivityY);
- UFUNCTION()
- void PlayerMovement();
- protected:
- // Called when the game starts or when spawned
- virtual void BeginPlay() override;
- virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
- public:
- // Called every frame
- virtual void Tick(float DeltaTime) override;
- // Called to bind functionality to input
- virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
- private:
- UFUNCTION(BlueprintCallable)
- void PitchCamera(float Value);
- UFUNCTION(BlueprintCallable)
- void YawCamera(float Value);
- UFUNCTION(BlueprintCallable)
- void MoveForward(float Value);
- UFUNCTION(BlueprintCallable)
- void MoveRight(float Value);
- UFUNCTION(BlueprintCallable)
- void TestInput();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement