// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action. #pragma once #include "CoreMinimal.h" #include "Camera/CameraComponent.h" #include "GameplayTagContainer.h" #include "OLSCameraComponent.generated.h" DECLARE_DELEGATE_RetVal(TSubclassOf, FOLSCameraModeDelegate); /** * UOLSCameraComponent * * The base camera component class used by this project. */ UCLASS() class OLS_API UOLSCameraComponent : public UCameraComponent { GENERATED_BODY() public: UOLSCameraComponent(const FObjectInitializer& objectInitializer); // Returns the camera component if one exists on the specified actor. UFUNCTION(BlueprintPure, Category = "OLS|Camera") static UOLSCameraComponent* FindCameraComponent(const AActor* Actor); // Returns the target actor that the camera is looking at. virtual AActor* GetTargetActor() const; // Delegate used to query for the best camera mode. FOLSCameraModeDelegate DetermineCameraModeDelegate; // Add an offset to the field of view. The offset is only for one frame, it gets cleared once it is applied. void AddFieldOfViewOffset(float FovOffset); virtual void DrawDebug(UCanvas* canvas) const; // Gets the tag associated with the top layer and the blend weight of it void GetBlendInfo(float& outWeightOfTopLayer, FGameplayTag& outTagOfTopLayer) const; protected: virtual void OnRegister() override; virtual void GetCameraView(float deltaTime, FMinimalViewInfo& desiredView) override; virtual void UpdateCameraModes(); protected: // Stack used to blend the camera modes. UPROPERTY() TObjectPtr CameraModeStack = nullptr; // Offset applied to the field of view. The offset is only for one frame, it gets cleared once it is applied. float FieldOfViewOffset = 0.0f; };