#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 // --------------------------------------------------------------------------------------------- // /// Manages a camera-fade in running as a latent (background) action class FFadeInAction : public FPendingLatentAction { /// Initializes a new fade-in action /// @param latentInfo Information container for the running latent action /// @param camera Camera component that is being faded in /// @param durationSeconds Duration in seconds over which the fade will happen public: FFadeInAction( const FLatentActionInfo &latentInfo, APlayerCameraManager *cameraManager, float durationSeconds ); /// 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("Fading in (%i %%)"), static_cast(this->elapsedSeconds * 100.0f / this->durationSeconds) ); } #endif /// 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: APlayerCameraManager *cameraManager; /// Total time the operation will run for private: float durationSeconds; /// Number of seconds the fade has already run for private: float elapsedSeconds; }; // --------------------------------------------------------------------------------------------- //