// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Scripting/ScriptingObject.h" #include "Engine/Core/ISerializable.h" #if USE_EDITOR #include "Engine/Core/Math/Color.h" #endif class AnimatedModel; class Animation; /// /// The animation notification event triggered during animation playback. /// API_CLASS(Abstract) class FLAXENGINE_API AnimEvent : public ScriptingObject, public ISerializable { DECLARE_SCRIPTING_TYPE(AnimEvent); #if USE_EDITOR /// /// Event display color in the Editor. /// API_FIELD(Attributes="HideInEditor, NoSerialize") Color Color = Color::White; #endif /// /// Animation event notification. /// /// The animated model actor instance. /// The source animation. /// The current animation time (in seconds). /// The current animation tick delta time (in seconds). API_FUNCTION() virtual void OnEvent(AnimatedModel* actor, Animation* anim, float time, float deltaTime) { } // [ISerializable] void Serialize(SerializeStream& stream, const void* otherObj) override; void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override; }; /// /// The animation notification event (with duration) triggered during animation playback that contains begin and end (event notification is received as a tick). /// API_CLASS(Abstract) class FLAXENGINE_API AnimContinuousEvent : public AnimEvent { DECLARE_SCRIPTING_TYPE(AnimContinuousEvent); /// /// Animation notification called before the first event. /// /// The animated model actor instance. /// The source animation. /// The current animation time (in seconds). /// The current animation tick delta time (in seconds). API_FUNCTION() virtual void OnBegin(AnimatedModel* actor, Animation* anim, float time, float deltaTime) { } /// /// Animation notification called after the last event (guaranteed to be always called). /// /// The animated model actor instance. /// The source animation. /// The current animation time (in seconds). /// The current animation tick delta time (in seconds). API_FUNCTION() virtual void OnEnd(AnimatedModel* actor, Animation* anim, float time, float deltaTime) { } };