// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Memory/Memory.h" /// /// Engine objects flags used in various aspects but packed into a single flags container. /// enum class ObjectFlags : uint32 { None = 0, WasMarkedToDelete = 1 << 0, UseGameTimeForDelete = 1 << 1, IsRegistered = 1 << 2, IsManagedType = 1 << 3, IsDuringPlay = 1 << 4, IsCustomScriptingType = 1 << 5, }; DECLARE_ENUM_OPERATORS(ObjectFlags); /// /// Interface for Engine objects. /// class FLAXENGINE_API Object { public: /// /// The object flags. /// ObjectFlags Flags = ObjectFlags::None; public: /// /// Finalizes an instance of the class. /// virtual ~Object(); /// /// Gets the string representation of this object. /// virtual String ToString() const = 0; /// /// Deletes the object without queueing it to the ObjectsRemovalService. /// void DeleteObjectNow(); /// /// Deletes the object (deferred). /// /// The time to live (in seconds). Use zero to kill it now. /// True if unscaled game time for the object life timeout, otherwise false to use absolute time. void DeleteObject(float timeToLive = 0.0f, bool useGameTime = false); /// /// Deletes the object. Called by the ObjectsRemovalService. Can be overriden to provide custom logic per object (cleanup, etc.). /// virtual void OnDeleteObject() { Delete(this); } }; // [Deprecated on 5.01.2022, expires on 5.01.2024] typedef Object RemovableObject;