// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/Pawn.h" #include "MyDefaultPawn.generated.h" class UInputComponent; class UPawnMovementComponent; class USphereComponent; class UStaticMeshComponent; /** * */ UCLASS(config = Game, Blueprintable, BlueprintType) class PRESIDENTSBRIGADE_API AMyDefaultPawn : public APawn { GENERATED_BODY() AMyDefaultPawn(const FObjectInitializer& ObjectInitializer); // Begin Pawn overrides virtual UPawnMovementComponent* GetMovementComponent() const override; virtual void SetupPlayerInputComponent(UInputComponent* InInputComponent) override; virtual void UpdateNavigationRelevance() override; /** * Input callback to move forward in local space (or backward if Val is negative). * @param Val Amount of movement in the forward direction (or backward if negative). * @see APawn::AddMovementInput() */ UFUNCTION(BlueprintCallable, Category = "Pawn") virtual void MoveForward(float Val); /** * Input callback to strafe right in local space (or left if Val is negative). * @param Val Amount of movement in the right direction (or left if negative). * @see APawn::AddMovementInput() */ UFUNCTION(BlueprintCallable, Category = "Pawn") virtual void MoveRight(float Val); /** * Input callback to move up in world space (or down if Val is negative). * @param Val Amount of movement in the world up direction (or down if negative). * @see APawn::AddMovementInput() */ UFUNCTION(BlueprintCallable, Category = "Pawn") virtual void MoveUp_World(float Val); /** * Called via input to turn at a given rate. * @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired turn rate */ UFUNCTION(BlueprintCallable, Category = "Pawn") virtual void TurnAtRate(float Rate); /** * Called via input to look up at a given rate (or down if Rate is negative). * @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired turn rate */ UFUNCTION(BlueprintCallable, Category = "Pawn") virtual void LookUpAtRate(float Rate); public: /** Name of the MovementComponent. Use this name if you want to use a different class (with ObjectInitializer.SetDefaultSubobjectClass). */ static FName MovementComponentName; protected: /** DefaultPawn movement component */ UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) UPawnMovementComponent* MovementComponent; public: /** Name of the CollisionComponent. */ static FName CollisionComponentName; private: /** DefaultPawn collision component */ UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) USphereComponent* CollisionComponent; public: /** Name of the MeshComponent. Use this name if you want to prevent creation of the component (with ObjectInitializer.DoNotCreateDefaultSubobject). */ static FName MeshComponentName; private: /** The mesh associated with this Pawn. */ UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* MeshComponent; public: /** If true, adds default input bindings for movement and camera look. */ UPROPERTY(Category = Pawn, EditAnywhere, BlueprintReadOnly) uint32 bAddDefaultMovementBindings : 1; /** Returns CollisionComponent subobject **/ USphereComponent* GetCollisionComponent() const { return CollisionComponent; } /** Returns MeshComponent subobject **/ UStaticMeshComponent* GetMeshComponent() const { return MeshComponent; } };