初始提交: UE5.3项目基础框架
This commit is contained in:
57
Source/BXSSP/Public/RoverController.h
Normal file
57
Source/BXSSP/Public/RoverController.h
Normal file
@ -0,0 +1,57 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "RoverController.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class BXSSP_API ARoverController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
ARoverController();
|
||||
|
||||
// 设置鼠标显示状态
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetMouseShowStatus(bool bStatus);
|
||||
|
||||
// 获得鼠标下撞击点位置
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool GetUnderMouseHitPosition(FHitResult& HitResult);
|
||||
|
||||
// 获得屏幕中心撞击位置
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetUnderscreenCenterHitPosition(FHitResult& HitResult);
|
||||
bool GetUnderScreenHitPosition(const FVector2D& ScreenPosition, FHitResult& HitResult);
|
||||
UFUNCTION(BlueprintPure)
|
||||
static FVector2D GetScreenCenterPosition();
|
||||
protected:
|
||||
|
||||
virtual void BeginPlay()override;
|
||||
|
||||
private:
|
||||
// 重置鼠标位置到点击点
|
||||
void ResetMousePositionToClickPoint();
|
||||
UFUNCTION()
|
||||
void RotateCameraToTargetPoint(FRotator Rotation);
|
||||
private:
|
||||
|
||||
// 把鼠标位置重置到屏幕开始点击时的位置(用于防止鼠标拖到屏幕边界出现不能拖动情况)
|
||||
FTimerHandle ResetMousePositionTimer;
|
||||
|
||||
FVector2D ClickMousePosition;
|
||||
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Player, meta = (AllowPrivateAccess = "true"))
|
||||
class ARover* Rover;
|
||||
public:
|
||||
static ARoverController* PlayerController;
|
||||
// (当开始自动旋转时,先让摄像机看向目标对象)时用的计时器
|
||||
FTimerHandle RotateCameraTimer;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user