#pragma region CPL License /* Nuclex Unreal Module Copyright (C) 2014-2021 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #pragma once #include #include #include #include // --------------------------------------------------------------------------------------------- // /// Manages a camera movement running as a latent (background) action class FFlyCameraAction : public FPendingLatentAction { /// Initializes a new camera movement action /// @param latentInfo Information container for the running latent action /// @param pawn Pawn (holding the camera) that will fly to a new position /// @param target Target transformation the camera will assume /// @param durationSeconds Duration in seconds over which the fade will happen /// @param easingFunction Easing method that will be used for the camera path public: FFlyCameraAction( const FLatentActionInfo &latentInfo, APawn *pawn, const FTransform &target, float durationSeconds, EEasingFunc::Type easingFunction ); /// Called once per tick to update the state of the latent action /// @param response Helper providing informations and notification capabilities public: void UpdateOperation(FLatentResponse &response) override; #if defined(WITH_EDITOR) && (WITH_EDITOR == 1) /// Returns a human readable description of the latent operation's current state public: FString GetDescription() const override { return FString::Printf( TEXT("Reposition camera (%i %%)"), static_cast(this->elapsedSeconds * 100.0f / this->durationSeconds) ); } #endif /// Updates the position and orientation of the pawn /// @param newTransform New position and orientation the pawn will assume private: void updatePawnTransform(const FTransform &newTransform); /// Object on which to invoke the callback function to continue execution private: FWeakObjectPtr callbackTarget; /// Callback function to continue execution of the blueprint graph private: FName executionFunction; /// State in which the blueprint graph is current waiting (each node has a number) private: int32 outputLink; /// Camera on which the fade-in will take place private: APawn *pawn; /// Transformation at which the camera's path started private: FTransform origin; /// Transformation the camera will assume at the end of the path private: FTransform target; /// Total time the operation will run for private: float durationSeconds; /// Number of seconds the fade has already run for private: float elapsedSeconds; /// Easing function that will be applied across the camera's movement private: EEasingFunc::Type easingFunction; }; // --------------------------------------------------------------------------------------------- //