主题
GameCore.ModelAnimation
Animation 双端
命名空间 GameCore.ModelAnimation
csharp
public class Animation : IAnimationSwingControllerRepresents a runtime animation instance that wraps engine-level animation functionality and provides high-level control over animation playback, timing, and state management.
备注
The Animation class serves as the primary interface for controlling individual animations in the game world. It bridges the gap between the low-level engine animation system (IViewAnimation) and the high-level game logic, providing a clean API for animation management. Key features:
- Priority-based animation management with automatic suppression
- Smooth blending between animations with configurable timing
- Real-time playback control (speed, looping, offset)
- Event-driven state notifications
- Automatic resource management and cleanup
- Integration with the actor system for spatial coordination Animation instances are typically created through
IActorAnimationPlayableinterface methods rather than direct construction, ensuring proper integration with the actor lifecycle and animation management systems.
构造函数
Animation 仅客户端
csharp
public Animation(IGameLink<GameDataAnimationSimple> link, IActor actor, IViewAnimation viewAnimation)Animation 仅客户端
csharp
protected internal Animation(IActor actor, IViewAnimation viewAnimation)Animation 仅服务端
csharp
public Animation()属性
Actor 仅客户端
csharp
public IActor Actor { get; }AnimationResource 仅客户端
csharp
public GameCore.ResourceType.Animation AnimationResource { get; }Gets the animation resource file that this animation instance is playing.
备注
This property provides access to the original animation resource that was used to create this animation instance. It can be used for debugging, logging, or to identify which animation file is currently being played.
IsValid 仅客户端
csharp
public override bool IsValid { get; }Gets a value indicating whether this animation instance is valid and ready for use.
备注
An animation is considered valid when both the base object validity checks pass and the underlying engine animation is in a valid state (Phase >= 0). Invalid animations should not be used for playback control and may indicate the animation has been destroyed or encountered an error.
IsActivePlaying 仅客户端
csharp
public bool IsActivePlaying { get; }Gets a value indicating whether this animation is currently actively playing.
备注
This property returns true only when the animation is in the current actor's active animation list and is not suppressed by higher priority animations and not paused. An animation can exist but not be actively playing if it has been suppressed by a higher priority animation or if it has been paused. Use this property to check if an animation is actually contributing to the visual appearance of the actor, as opposed to just existing in the animation system.
Priority 仅客户端
csharp
public int Priority { get; set; }Gets or sets the priority of this animation instance.
备注
Animation priority determines which animation is visible when multiple animations are playing on the same actor. Higher priority animations will suppress lower priority animations, causing them to be paused until the higher priority animation completes or is stopped. Values below 0 are treated as 0, and values above 31 are treated as 31 by the native animation layer packing. Priority can be changed at runtime to dynamically adjust animation precedence. This is useful for implementing dynamic animation systems where the importance of animations can change based on game state.
LogicLayer 仅客户端
csharp
public AnimationLogicLayer LogicLayer { get; }Gets the logic layer that this animation belongs to.
备注
Logic layers provide a way to categorize animations and control their interactions. Animations on different logic layers can play simultaneously without interfering with each other, while animations on the same layer compete based on priority. This property is read-only and is set when the animation is created.
Duration 仅客户端
csharp
public TimeSpan Duration { get; }Gets the total duration of this animation.
备注
This represents the total length of the animation from start to finish. For looping animations, this is the duration of one complete loop. The duration is determined by the animation resource file and cannot be changed at runtime.
IsLooping 仅客户端
csharp
public bool IsLooping { get; set; }Gets or sets a value indicating whether this animation should loop continuously.
备注
When set to true, the animation will automatically restart from the beginning when it reaches the end, creating a continuous loop. When set to false, the animation will play once and then stop. This property can be changed at runtime to dynamically control looping behavior.
IsSuppressed 仅客户端
csharp
public bool IsSuppressed { get; }Gets a value indicating whether this animation is currently suppressed by a higher priority animation.
备注
A suppressed animation is paused and not contributing to the actor's visual appearance due to a higher priority animation being active on the same logic layer. The animation will automatically resume when the higher priority animation finishes or is stopped. This property is read-only and reflects the current state of the animation system.
ShouldPauseOnSuppressed 仅客户端
csharp
public bool ShouldPauseOnSuppressed { get; set; }Gets or sets a value indicating whether this animation should pause when suppressed.
备注
When set to true, the animation will pause its timeline when suppressed by a higher priority animation, resuming from the same point when it becomes active again. When set to false, the animation continues to advance its timeline even when suppressed, which may result in missing portions of the animation when it becomes active again. This setting is useful for animations that need to maintain timing synchronization with other systems even when not visible.
PlayingOffset 仅客户端
csharp
public TimeSpan PlayingOffset { get; set; }Gets or sets the current playback time offset within the animation.
备注
This property allows you to jump to specific time points in the animation timeline. The value represents the elapsed time from the start of the animation, so setting it to TimeSpan.FromSeconds(2.5) will jump to 2.5 seconds into the animation. Setting this property will immediately jump the animation to the specified time offset, which can be useful for synchronizing animations, implementing scrubbing functionality, or creating specific timing effects. The offset should not exceed the animation's total duration. Values beyond the duration may cause unexpected behavior or be clamped to the animation's length.
Speed 仅客户端
csharp
public float Speed { get; set; }Gets or sets the playback speed multiplier for this animation.
备注
This property allows you to dynamically control the playback speed of the animation. Values less than 1.0 slow down the animation, while values greater than 1.0 speed it up. A value of 0.0 will effectively pause the animation. Speed changes take effect immediately and can be used to create effects like slow motion, fast-forward, or to synchronize animations with dynamic game timing. Note: If you want to pause the animation while preserving the ability to resume at the same speed, use the Paused property instead of setting Speed to 0.
Paused 仅客户端
csharp
public bool Paused { get; set; }EngineAnimationType 仅客户端
csharp
public EngineAnimationType EngineAnimationType { get; }Gets the engine-specific animation type for this animation instance.
备注
This property provides access to the engine-level animation type, which is used internally by the animation system for optimization and behavior control. This is primarily useful for debugging and advanced animation system development.
Link 仅客户端
csharp
public IGameLink<GameDataAnimationSimple>? Link { get; }Cache 仅客户端
csharp
public GameDataAnimationSimple? Cache { get; }方法
FadeBlendWeight 仅客户端
csharp
public bool FadeBlendWeight(float targetWeight, TimeSpan fadeTime)Gradually fades the blend weight of this animation to a target value over a specified duration.
targetWeight— The target blend weight to fade to, typically between 0.0 and 1.0.fadeTime— The duration over which the fade should occur.
返回: True if the fade was successfully initiated; otherwise, false.
备注
Blend weight fading allows for smooth transitions in animation visibility without completely stopping the animation. This is useful for creating dynamic blending effects where animations need to gradually appear or disappear while maintaining their timeline position. A target weight of 0.0 will make the animation completely invisible, while 1.0 will make it fully visible. Values between 0.0 and 1.0 create partial blending effects. The fade operates independently of the animation's priority system, allowing for complex blending scenarios where multiple animations contribute to the final appearance.
Stop 仅客户端
csharp
public virtual bool Stop(TimeSpan? fadeOutTime = null)Stops the animation with an optional fade-out transition.
fadeOutTime— The duration over which the animation should fade out before stopping. If null, uses the default fade time of 0.15 seconds.
返回: True if the stop was successfully initiated; otherwise, false.
备注
This method gracefully terminates the animation, optionally providing a smooth fade-out transition to avoid abrupt visual changes. The fade-out allows the animation to blend smoothly to its final state or to other animations that may become active. Once stopped, the animation cannot be restarted - a new animation instance must be created to play the same animation again. The animation resources will be automatically cleaned up when the stop process completes. If other animations were suppressed by this animation, they will automatically resume when this animation stops, creating a smooth transition in the animation system.
ViewAnimationTimedEventTriggered 仅客户端
csharp
protected void ViewAnimationTimedEventTriggered(UTF8String eventName, bool isStart)Cast 仅客户端
csharp
public void Cast()DisposeManaged 仅客户端
csharp
protected override void DisposeManaged()事件
StateChanged 仅客户端
csharp
public event Action<AnimationStateEvent>? StateChangedOccurs when the animation state changes, providing notifications for key animation events.
备注
This event is fired when significant state changes occur in the animation lifecycle, such as when the animation starts, finishes, or is removed from the system. The event provides AnimationStateEvent values that indicate the specific type of state change that occurred:
Surfaced: Animation became active (started playing or resumed from suppression)Suppressed: Animation was suppressed by a higher priority animationCompleted: Animation finished playing normallyRemoved: Animation was removed from the system This event is essential for implementing animation-driven game logic, such as triggering effects when animations complete, chaining animations together, or cleaning up resources when animations are removed.
TimelineEventTriggered 仅客户端
csharp
public event Action<UTF8String, bool>? TimelineEventTriggeredOccurs when a timeline event marker is triggered during animation playback.
备注
This event is fired when the animation timeline reaches predefined event markers that are defined in the Events data. These markers allow developers to synchronize game logic with specific moments in the animation, such as footstep sounds, weapon impacts, or particle effects. Timeline events have a duration and can trigger twice during playback:
- At the start of the event duration (when the boolean parameter is true)
- At the end of the event duration (when the boolean parameter is false) The event provides two parameters:
eventName: The name/identifier of the timeline event as defined in the animationisStart: True if this is the start of the event duration, false if it's the end Timeline events are frame-accurate and will trigger at the exact moments specified in the animation, taking into account the current playback speed and time offset. This ensures precise synchronization between animation and gameplay elements. This event is particularly useful for:- Playing sound effects with proper start/stop timing
- Triggering particle effects that need specific durations
- Implementing frame-perfect gameplay mechanics with duration-based logic
- Synchronizing UI animations with character actions that have timing windows
字段
_animationCache 仅客户端
csharp
protected static readonly ConditionalWeakTable<IViewAnimation, Animation> _animationCacheviewAnimation 仅客户端
csharp
protected IViewAnimation viewAnimationdisposedByStop 仅客户端
csharp
protected bool disposedByStopAnimationBracket 双端
命名空间 GameCore.ModelAnimation
csharp
public class AnimationBracket : Animation, IAnimationSwingControllerRepresents a bracket animation controller that manages lifecycle-based animations following the Birth → Stand → Death pattern commonly used for temporary effects and actors.
备注
AnimationBracket provides a specialized animation controller for managing three-stage animation sequences that follow a predictable lifecycle pattern. This pattern is commonly used for:
- Temporary visual effects that appear, persist, and disappear
- Enemy spawn sequences with birth, idle, and death animations
- Environmental objects with activation, active, and deactivation states
- UI elements with show, display, and hide transitions The bracket system automatically manages the transitions between stages and can be configured to either loop the stand animation indefinitely or play through all stages once (one-shot mode). Key features:
- Automatic stage progression with configurable timing
- Support for both looping and one-shot playback modes
- Optional actor destruction when the death animation completes
- Integration with the priority-based animation system
- Ability to skip the birth animation for immediate activation
构造函数
AnimationBracket 仅客户端
csharp
public AnimationBracket(IGameLink<GameDataAnimationBracket> link, IActor actor, IViewAnimation viewAnimation)AnimationBracket 仅服务端
csharp
public AnimationBracket()属性
Link 仅客户端
csharp
public new IGameLink<GameDataAnimationBracket>? Link { get; }Cache 仅客户端
csharp
public new GameDataAnimationBracket? Cache { get; }Stage 仅客户端
csharp
public BracketStage Stage { get; }方法
AdjustDurationByCastTime 仅客户端
csharp
public void AdjustDurationByCastTime(AbilityActive abilityActive)Stop 仅客户端
csharp
public bool Stop(bool skipDeath = false)Stops the bracket animation sequence, optionally skipping the death animation.
skipDeath— If true, the death animation will be skipped and the bracket will stop immediately. If false, the death animation will play before stopping if the bracket is currently playing stand animation.
返回: True if the stop was successfully initiated; otherwise, false.
备注
This method triggers the termination of the bracket animation sequence. By default, it will transition to the death animation stage and play it to completion before stopping. If skipDeath is true, the sequence will stop immediately without playing the death animation. If the bracket is configured with KillOnFinish set to true, the associated actor will be destroyed when the death animation completes (or immediately if skipDeath is true). This method is typically called when the bracket animation needs to be terminated prematurely, such as when the associated effect or actor is no longer needed.
SwitchToNextStage 仅客户端
csharp
public bool SwitchToNextStage()Stop 仅客户端
csharp
public override bool Stop(TimeSpan? fadeOutTime = null)DisposeManaged 仅客户端
csharp
protected override void DisposeManaged()AnimationSequence 双端
命名空间 GameCore.ModelAnimation
csharp
public class AnimationSequence : IAnimationSwingController构造函数
AnimationSequence 仅客户端
csharp
public AnimationSequence(IGameLink<GameDataAnimationSequence> link, IActor actor, IViewAnimationSequence viewAnimationSequence, bool triggerEvents = true)AnimationSequence 仅服务端
csharp
public AnimationSequence()属性
Actor 仅客户端
csharp
public IActor Actor { get; }EventsEnabled 仅客户端
csharp
public bool EventsEnabled { get; }PlaybackIndex 仅客户端
csharp
public int PlaybackIndex { get; }Link 仅客户端
csharp
public IGameLink<GameDataAnimationSequence> Link { get; }Cache 仅客户端
csharp
public GameDataAnimationSequence Cache { get; }方法
SwitchToPlayback 仅客户端
csharp
public void SwitchToPlayback(int? playbackIndex = null)Switches to the specified playback within the animation sequence.
playbackIndex— The zero-based index of the playback to switch to. If null, advances to the next playback in sequence.
备注
This method allows dynamic control over which playback configuration is currently active within the sequence. Each playback represents a different animation configuration with its own timing, blending, and duration settings as defined in the sequence data. When switching playbacks:
- The current playback will blend out according to its blend settings
- The target playback will blend in smoothly to avoid jarring transitions
- Any spawned actors from the previous playback may be affected based on their lifecycle settings
- Events associated with the new playback will be scheduled according to the new timeline If playbackIndex is null, the sequence will advance to the next playback in the list. If already at the last playback, the behavior depends on the sequence's loop settings.
Pause 仅客户端
csharp
public void Pause()Pauses the animation sequence, suspending all playback, timing, and event processing.
备注
When paused, the sequence maintains its current state but stops all progression:
- Animation playbacks are paused at their current frame
- Event timers are suspended (events will not fire)
- Spawned actors remain active but their sequence-controlled behaviors are paused
- The sequence can be resumed from exactly the same point using
ResumeThis is useful for implementing pause functionality in games, waiting for external conditions, or creating interactive moments where the sequence waits for user input. Calling Pause() on an already paused sequence has no effect.
Resume 仅客户端
csharp
public void Resume()Resumes a paused animation sequence, continuing from where it was paused.
备注
Resume restores the sequence to active playback state:
- Animation playbacks continue from their paused frame
- Event timers resume counting down from their suspended state
- All sequence elements continue their progression as if no pause occurred
- The timing remains consistent with the original sequence timeline This method only affects paused sequences. Calling Resume() on an already playing sequence has no effect. The sequence will fire any events that should have occurred during the pause period if their timing has been reached when resuming.
Stop 仅客户端
csharp
public void Stop()Stops the animation sequence completely, ending all playback and cleaning up resources.
备注
Stop performs a complete shutdown of the sequence:
- All animation playbacks are immediately stopped
- Spawned actors are despawned according to their cleanup settings
- Pending events are cancelled and will not fire
- The sequence returns to its initial state
- Resources are cleaned up to prevent memory leaks Unlike pause, stopping a sequence cannot be resumed - it must be restarted from the beginning with a new
Playcall. This is typically used when the sequence should be completely terminated, such as when switching to a different sequence or ending a cutscene. Calling Stop() on an already stopped sequence has no effect.
DisposeManaged 仅客户端
csharp
protected override void DisposeManaged()事件
EventTriggered 仅客户端
csharp
public event Action<SequenceEventArgs>? EventTriggeredOccurs when a sequence event is triggered, providing detailed context about the event and sequence state.
备注
This event is fired whenever a SequenceEvent reaches its scheduled time offset within the animation sequence. The event provides comprehensive context through SequenceEventArgs, including:
- The sequence instance that triggered the event
- The specific event key that was triggered
- Timing information (elapsed time since sequence start)
- The playback index that was active when the event fired Event handlers can use this information to:
- Coordinate gameplay actions with animation timing
- Trigger sound effects, particle systems, or other visual elements
- Apply damage, healing, or other game mechanics at precise moments
- Implement interactive elements or conditional sequence branching
- Log or debug sequence behavior Events are fired in the order they are scheduled, and if a sequence event has
PauseSequenceset to true, the sequence will automatically pause after firing this event.
Removed 仅客户端
csharp
public event Action? RemovedPlaybackIndexChanged 仅客户端
csharp
public event Action<int>? PlaybackIndexChanged字段
viewAnimationSequence 仅客户端
csharp
protected IViewAnimationSequence viewAnimationSequenceBoneChain 双端
命名空间 GameCore.ModelAnimation
csharp
public class BoneChain : DisposableObject构造函数
BoneChain 双端
csharp
protected internal BoneChain(int chainId, IActorAnimationPlayable actor, IEnumerable<IViewAsyncActor.ModelBoneWeight> modelBoneWeights)属性
ChainId 双端
csharp
public int ChainId { get; set; }Actor 双端
csharp
public IActorAnimationPlayable Actor { get; set; }ModelBoneWeights 双端
csharp
public IEnumerable<IViewAsyncActor.ModelBoneWeight> ModelBoneWeights { get; set; }方法
SetFacing 仅客户端
csharp
public bool SetFacing(float facing, float duration = 0f)ResetFacing 仅客户端
csharp
public bool ResetFacing(float duration = 0f)DisposeManaged 双端
csharp
protected override void DisposeManaged()IAnimationSwingController 双端
命名空间 GameCore.ModelAnimation
csharp
public interface IAnimationSwingController技能动画控制器,接收前摇、出手、引导和后摇阶段通知。 每轮起手创建新的控制器,重新接近或离开指令时停止本轮控制器。
属性
IsValid 仅客户端
csharp
public bool IsValid { get; }方法
Stop 仅客户端
csharp
void Stop(TimeSpan? fadeOutTime = null)Stops the current animation.
Pause 仅客户端
csharp
void Pause(bool on)Pauses or resumes the animation.
on— True to pause, false to resume.
Preswing 仅客户端
csharp
void Preswing()开始前摇表现。在本轮控制器创建后、进入 Preswing 时调用。 内置数据工厂返回的控制器在此时启动实际播放;默认实现不额外改变播放状态。
Cast 仅客户端
csharp
void Cast()进入出手阶段(Cast)。此时尚未进入引导阶段,也不表示主效果已经发动。
Channel 仅客户端
csharp
void Channel()进入引导阶段(Channel)。默认不改变内置动画的播放时间轴。
Backswing 仅客户端
csharp
void Backswing()进入后摇阶段(Backswing)。
GameDataAnimationBracket 双端
命名空间 GameCore.ModelAnimation.Data
csharp
public class GameDataAnimationBracket : GameDataAnimation, IGameData<GameDataAnimationBracket>, IGameDataRepresents the configuration data for a bracket animation that manages lifecycle-based animations following the Birth → Stand → Death pattern.
备注
GameDataAnimationBracket provides configuration for three-stage animation sequences that follow a predictable lifecycle pattern. This is commonly used for:
- Temporary visual effects that appear, persist, and disappear
- Enemy or character spawn sequences
- Environmental objects with activation, active, and deactivation states
- UI elements with show, display, and hide transitions The bracket system provides automatic management of stage transitions and supports both looping and one-shot playback modes, making it ideal for effects that need predictable lifecycle management.
构造函数
GameDataAnimationBracket 双端
csharp
public GameDataAnimationBracket(GameLink<GameDataAnimation, GameDataAnimationBracket> link)GameDataAnimationBracket 双端
csharp
public GameDataAnimationBracket(IGameLink<GameDataAnimationBracket> link)属性
BirthStandDeathAnimation 双端
csharp
public BirthStandDeathAnimation? BirthStandDeathAnimation { get; set; }Gets or sets the birth, stand, and death animation configuration for this bracket.
备注
This property defines the three animation resources that will be used for each stage of the bracket animation lifecycle:
- Birth: The initial animation played when the bracket starts
- Stand: The looping animation played during the active phase
- Death: The final animation played when the bracket ends If this property is null, the bracket animation will not have any animations to play.
LogicLayer 双端
csharp
public AnimationLogicLayer LogicLayer { get; set; }Gets or sets the logic layer that this bracket animation will be played on.
备注
Logic layers provide a way to categorize animations and control their interactions. Bracket animations on different logic layers can play simultaneously without interfering with each other, while animations on the same layer compete based on priority.
Priority 双端
csharp
public int Priority { get; set; }Gets or sets the priority of this bracket animation.
备注
Animation priority determines which animation is visible when multiple animations are playing on the same actor and logic layer. Higher priority bracket animations will suppress lower priority animations, causing them to be paused until the higher priority animation completes or is stopped. Values below 0 are treated as 0, and values above 31 are treated as 31 by the native animation layer packing. The priority applies to all stages of the bracket animation (birth, stand, and death).
ForceOneShot 双端
csharp
public bool ForceOneShot { get; set; }Gets or sets a value indicating whether the bracket should play all stages once (one-shot mode) or loop the stand animation indefinitely.
备注
When set to true, the bracket will play through all three stages sequentially: Birth animation → Stand animation (once) → Death animation, then stop. When set to false, the bracket will play the Birth animation once, then loop the Stand animation indefinitely until manually stopped, at which point the Death animation will play. One-shot mode is useful for effects with predetermined durations, while looping mode is ideal for effects that need to persist until external conditions change.
KillOnFinish 双端
csharp
public bool KillOnFinish { get; set; }Gets or sets a value indicating whether the associated actor should be destroyed when the bracket animation completes.
备注
When set to true, the actor associated with this bracket animation will be automatically destroyed when the death animation completes. This is useful for temporary effects, spawned enemies, or other actors that should be cleaned up when their animation lifecycle ends. When set to false, the actor will remain in the scene after the animation completes, allowing it to be reused or controlled by other systems.
SkipBirthAnimation 双端
csharp
public bool SkipBirthAnimation { get; set; }Gets or sets a value indicating whether the birth animation should be skipped.
备注
When set to true, the bracket will skip the birth animation and immediately begin playing the stand animation. This is useful when you want the effect to appear instantly without any spawn/appear animation. This setting is particularly useful for effects that need to be synchronized with other systems or when the birth animation is not needed for the desired visual effect.
Link 双端
csharp
public new IGameLink<GameDataAnimationBracket> Link { get; }方法
CreateSwingController 仅客户端
csharp
public override IAnimationSwingController? CreateSwingController(IActorAnimationPlayable animationPlayable, TimeSpan? totalTime)GameDataAnimationSequence 双端
命名空间 GameCore.ModelAnimation.Data
csharp
public class GameDataAnimationSequence : GameDataAnimation, IGameDataNativeCacheRefreshable, IGameData<GameDataAnimationSequence>, IGameDataRepresents a comprehensive animation sequence configuration that orchestrates multiple animation playbacks, actor creations, and event triggers over time to create complex, synchronized animation experiences.
备注
GameDataAnimationSequence serves as a high-level animation composition tool that allows you to:
- Orchestrate multiple animation playbacks with precise timing and blending
- Spawn and manage temporary actors during specific moments in the sequence
- Trigger events at designated time offsets for game logic integration This class is particularly useful for creating cutscenes, complex ability animations, environmental sequences, or any scenario where multiple visual and gameplay elements need to be synchronized with precise timing control. The sequence execution follows this pattern:
- Animation playbacks are initiated according to their individual timing configurations
- Sequence actors are created at their specified spawn offsets and remain active for their configured durations
- Sequence events are triggered at their designated time offsets
- All elements are coordinated to create a cohesive, synchronized experience
构造函数
GameDataAnimationSequence 双端
csharp
public GameDataAnimationSequence(GameLink<GameDataAnimation, GameDataAnimationSequence> link)GameDataAnimationSequence 双端
csharp
public GameDataAnimationSequence(IGameLink<GameDataAnimationSequence> link)属性
Playbacks 双端
csharp
public List<AnimationPlayback> Playbacks { get; set; }Gets or sets the collection of animation playbacks that will be executed during the sequence.
备注
The playbacks in this collection are processed according to the sequential order.
SequenceActors 双端
csharp
public List<SequenceActorSpawn> SequenceActors { get; set; }Gets or sets the collection of actors that will be dynamically created and managed during the animation sequence.
备注
Sequence actors provide a way to dynamically spawn temporary visual or gameplay elements that are synchronized with the animation timeline. These actors are automatically created at their specified SpawnOffset and remain active for their specified Duration. All sequence actors are automatically attached to the parent actor that is playing the sequence, ensuring proper spatial relationships and lifecycle management. This is ideal for effects like:
- Particle systems that should appear during specific moments
- Temporary visual elements like magic circles or weapon trails
- Supporting actors that enhance the main animation sequence
SequenceEvents 双端
csharp
public List<SequenceEvent> SequenceEvents { get; set; }Gets or sets the collection of events that will be triggered at specific time offsets during the animation sequence.
备注
Sequence events provide integration points between the animation system and game logic, allowing the sequence to communicate with other systems at precise moments. Events are triggered based on their Offset relative to the sequence start time. Events can optionally pause the sequence execution using PauseSequence, which is useful for creating interactive moments or waiting for external conditions before continuing.
TriggerEvents 双端
csharp
public bool TriggerEvents { get; set; }Link 双端
csharp
public new IGameLink<GameDataAnimationSequence> Link { get; }方法
CreateSwingController 仅客户端
csharp
public override IAnimationSwingController? CreateSwingController(IActorAnimationPlayable animationPlayable, TimeSpan? totalTime)SetNativeCacheRefresh 双端
csharp
public void SetNativeCacheRefresh(bool refresh = true)请求刷新此动画序列定义在 native 侧的缓存。
refresh— 为true时,请求 native 侧在下次读取此GameDataAnimationSequence定义时重建缓存; 为false时,清除此刷新请求。
备注
某些 GameDataAnimationSequence 定义在运行时会被 native 层缓存。 如果你在游戏运行过程中修改了这类定义,后续新创建的动画表现不一定会自动使用最新值。 调用此方法后,后续再次读取此定义的 native 逻辑会使用最新数据。 但已经创建并持有旧缓存结果的运行时对象,不保证立即更新。 未接通对应缓存链路的平台会安全忽略此请求。
GameDataAnimationSimple 双端
命名空间 GameCore.ModelAnimation.Data
csharp
public class GameDataAnimationSimple : GameDataAnimation, IGameData<GameDataAnimationSimple>, IGameDataRepresents the configuration data for a simple animation that can be played on game actors.
备注
GameDataAnimationSimple provides all the necessary configuration parameters for playing a single animation with specific timing, priority, and blending characteristics. This class serves as the data definition that is used to create Animation instances at runtime. The configuration includes:
- Animation resource file reference
- Playback parameters (speed, looping, timing)
- Priority and layer settings for animation conflict resolution
- Blending parameters for smooth transitions
- Body part targeting for partial animation support This class is typically used in game data files and can be referenced by actors or other systems that need to play animations with consistent parameters.
构造函数
GameDataAnimationSimple 双端
csharp
public GameDataAnimationSimple(GameLink<GameDataAnimation, GameDataAnimationSimple> link)GameDataAnimationSimple 双端
csharp
public GameDataAnimationSimple(IGameLink<GameDataAnimationSimple> link)属性
File 双端
csharp
public GameCore.ResourceType.Animation File { get; set; }Gets or sets the animation resource file that will be played.
备注
This property specifies the actual animation file that will be loaded and played when this animation configuration is used. The file should be a valid animation resource that has been imported into the game's resource system.
LogicLayer 双端
csharp
public AnimationLogicLayer LogicLayer { get; set; }Gets or sets the logic layer that this animation will be played on.
备注
Logic layers provide a way to categorize animations and control their interactions. Animations on different logic layers can play simultaneously without interfering with each other, while animations on the same layer compete based on priority. Common layer usage:
- Normal: Standard gameplay animations
- Additive: Overlay animations that blend with other animations
- Override: High-priority animations that override others
Priority 双端
csharp
public int Priority { get; set; }Gets or sets the priority of this animation.
备注
Animation priority determines which animation is visible when multiple animations are playing on the same actor and logic layer. Higher priority animations will suppress lower priority animations, causing them to be paused until the higher priority animation completes or is stopped. Valid values are 0 through 31. Values below 0 are treated as 0, and values above 31 are treated as 31 by the native animation layer packing. Typical values are organized as follows:
- 0-5: Idle and ambient animations
- 6-15: Movement or low-impact actions
- 16-25: Standard action animations
- 26-31: High-priority or override animations
BodyPart 双端
csharp
public AnimationBodyPart BodyPart { get; set; }Gets or sets the body part that this animation affects.
备注
Body part specification allows for partial animation support where different parts of the character can be animated independently. This enables complex animation blending scenarios such as:
- Upper body combat animations while lower body continues walking
- Facial expressions independent of body movement
- Separate arm animations for dual-wielding characters FullBody animations will affect the entire character model, while specific body part animations will only affect their designated portions.
Speed 双端
csharp
public float Speed { get; set; }Gets or sets the playback speed multiplier for this animation.
备注
This property controls the playback speed of the animation. Values less than 1.0 slow down the animation, while values greater than 1.0 speed it up. The speed affects the entire animation timeline proportionally. Common speed values:
- 0.5: Half speed (slow motion effect)
- 1.0: Normal speed
- 1.5: 50% faster
- 2.0: Double speed Speed can be changed at runtime through the Animation instance after playback begins.
BlendIn 双端
csharp
public TimeSpan BlendIn { get; set; }Gets or sets the blend-in time for smooth transitions when this animation becomes active.
备注
The blend-in time determines how smoothly this animation transitions in when it becomes the active animation. This occurs in several scenarios:
- When this animation starts playing and needs to blend from a previous animation
- When this animation resumes after being suppressed by a higher priority animation
- When this animation's priority is dynamically changed, causing it to become active During the blend-in period, the animation system will smoothly interpolate between the previous animation state and this animation, creating a natural transition without abrupt changes. Setting this to zero will cause immediate switching with no transition period. Longer blend times create smoother transitions but may delay the visual impact of the new animation.
StartOffset 双端
csharp
public TimeSpan StartOffset { get; set; }Gets or sets the time offset from the beginning of the animation where playback should start.
备注
This property allows you to skip the initial portion of an animation and start playback from a specific point in the timeline. This is useful for:
- Skipping slow wind-up portions of animations
- Starting animations at their most impactful moments
- Synchronizing animations with external events
- Creating variations of the same animation with different starting points The offset is measured from the beginning of the animation, so an offset of 1 second will skip the first second of the animation and begin playback from the 1-second mark.
IsLooping 双端
csharp
public bool IsLooping { get; set; }Gets or sets a value indicating whether this animation should loop continuously.
备注
When set to true, the animation will automatically restart from the beginning when it reaches the end, creating a continuous loop. This is commonly used for:
- Idle animations that should repeat indefinitely
- Environmental animations like flowing water or spinning objects
- Background animations that provide continuous movement When set to false, the animation will play once and then stop, which is appropriate for:
- One-time actions like attacks or spell casting
- Transition animations between states
- Cutscene animations with specific timing requirements The looping behavior can be changed at runtime through the Animation instance.
Link 双端
csharp
public new IGameLink<GameDataAnimationSimple> Link { get; }方法
CreateSwingController 仅客户端
csharp
public override IAnimationSwingController? CreateSwingController(IActorAnimationPlayable animationPlayable, TimeSpan? totalTime)SequenceActorSpawn 双端
命名空间 GameCore.ModelAnimation.Data.Struct
csharp
public class SequenceActorSpawnRepresents a configuration for spawning and managing a temporary actor during an animation sequence, defining what actor to spawn, when to spawn it, and how long it should exist.
备注
SequenceActorSpawn provides precise temporal control over actor lifecycle within animation sequences. This enables the creation of synchronized visual effects, temporary objects, and supporting elements that enhance the main animation with perfect timing coordination. The spawned actor will be automatically attached to the parent actor playing the sequence, ensuring proper spatial relationships and automatic cleanup when the sequence completes. Common use cases include:
- Particle effects that appear during specific animation moments
- Temporary visual elements like magic circles, auras, or weapon trails
- Supporting actors that provide context or enhancement to the main animation
- Environmental effects synchronized with character actions
构造函数
SequenceActorSpawn 双端
csharp
public SequenceActorSpawn()属性
Actor 双端
csharp
public required IGameLink<GameDataActor> Actor { get; set; }Gets or sets the actor configuration that will be spawned during the animation sequence.
备注
This property references the actor definition that will be instantiated and attached to the parent actor playing the sequence. The spawned actor will inherit spatial positioning from the parent and will be automatically managed throughout its lifecycle. The actor can be any valid game actor including visual effects, temporary objects, UI elements, or complex nested actor hierarchies that enhance the animation sequence.
SpawnOffset 双端
csharp
public TimeSpan SpawnOffset { get; set; }Gets or sets the time offset from the animation sequence start when this actor should be spawned.
备注
This offset allows precise synchronization of actor spawning with specific moments in the animation sequence. A value of zero means the actor spawns immediately when the sequence starts, while positive values delay the spawn until that time offset is reached. The timing is calculated from the sequence start time, not from any individual animation playback within the sequence, ensuring consistent timing regardless of animation complexity.
Duration 双端
csharp
public TimeSpan Duration { get; set; }Gets or sets how long the spawned actor should remain active and visible in the sequence.
备注
This duration controls the total lifespan of the spawned actor from its spawn time. The actor will be automatically despawned (destroyed) when this duration expires, calculated from the SpawnOffset time. For example, if SpawnOffset is 2 seconds and Duration is 3 seconds, the actor will:
- Spawn at 2 seconds into the sequence
- Remain active for 3 seconds
- Be automatically despawned at 5 seconds into the sequence A duration of zero creates an instantaneous effect that spawns and immediately despawns, which can be useful for one-time triggers or very brief visual effects.
SequenceEvent 双端
命名空间 GameCore.ModelAnimation.Data.Struct
csharp
public class SequenceEventRepresents a timed event that will be triggered at a specific moment during an animation sequence, providing integration points between the animation system and game logic.
备注
SequenceEvent enables precise synchronization between visual animations and gameplay mechanics by allowing events to be triggered at exact time offsets within an animation sequence. This creates opportunities for perfect timing coordination between animations and game systems. Events can optionally pause the sequence execution, which is useful for creating interactive moments, waiting for external conditions, or ensuring critical timing dependencies are met before the sequence continues. Common use cases include:
- Triggering sound effects at specific animation moments
- Applying damage or healing at precise timing during ability animations
- Signaling animation phase completions to other game systems
- Creating synchronization points for multiplayer or networked scenarios
- Triggering particle effects or environmental changes
- Notifying UI systems of animation milestones
构造函数
SequenceEvent 双端
csharp
public SequenceEvent()属性
EventKey 双端
csharp
public required SequenceEventKey EventKey { get; set; }Gets or sets the event key that identifies which event will be triggered when this sequence event activates.
备注
This event key serves as the strongly-typed identifier that game systems will use to respond to the triggered event. Using an enum-based key system provides better type safety, IntelliSense support, and prevents typos compared to string-based event names. Event keys are used by event aggregators, message systems, or direct event handlers to determine what action should be taken when the event is triggered at the specified timing. The enum-based approach ensures compile-time validation of event types.
Offset 双端
csharp
public TimeSpan Offset { get; set; }Gets or sets the time offset from the animation sequence start when this event should be triggered.
备注
This offset provides precise timing control for event triggering within the animation sequence. A value of zero means the event triggers immediately when the sequence starts, while positive values delay the event trigger until that time offset is reached. The timing is calculated from the sequence start time, ensuring consistent event timing regardless of the complexity or number of animation playbacks within the sequence. This allows for reliable synchronization between visual animations and gameplay events.
PauseSequence 双端
csharp
public bool PauseSequence { get; set; }Gets or sets a value indicating whether the animation sequence should pause execution when this event is triggered.
备注
When set to true, this property causes the entire animation sequence to pause execution when the event is triggered, allowing for interactive moments or external condition dependencies. The sequence will remain paused until explicitly resumed by external game logic. This feature is particularly useful for:
- Creating interactive cutscenes that wait for player input
- Synchronizing with external systems that may have variable timing
- Implementing conditional animation flows based on game state
- Ensuring critical events are properly processed before animation continues When
false(default), the event is triggered and the sequence continues normal execution without interruption, suitable for fire-and-forget events like sound effects or damage application.
AnimationEventKey 双端
命名空间 GameCore.ModelAnimation.Enum
csharp
public readonly struct AnimationEventKey : IGameClass, IExtendableEnum<AnimationEventKey>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(AnimationEventKey left, AnimationEventKey right)operator != 双端
csharp
public static bool operator !=(AnimationEventKey left, AnimationEventKey right)Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()字段
InnerValue 双端
csharp
public readonly System.Enum InnerValueBracketStage 双端
命名空间 GameCore.ModelAnimation.Enum
csharp
public enum BracketStageSpecifies the stages of a bracket animation lifecycle.
备注
BracketStage represents the different phases that a bracket animation goes through during its lifecycle. Each stage corresponds to a specific animation that is played during that phase of the bracket's execution.
枚举值
Stopped = -1— Represents a state where the operation has been stopped.None— No specific stage is active or the bracket is not running.Birth— The birth stage, where the initial spawn/appear animation is played.Stand— The stand stage, where the main/idle animation is played.Death— The death stage, where the final despawn/disappear animation is played.
SequenceEventKey 双端
命名空间 GameCore.ModelAnimation.Enum
csharp
public readonly struct SequenceEventKey : IGameClass, IExtendableEnum<SequenceEventKey>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(SequenceEventKey left, SequenceEventKey right)operator != 双端
csharp
public static bool operator !=(SequenceEventKey left, SequenceEventKey right)Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()字段
InnerValue 双端
csharp
public readonly System.Enum InnerValueWaitForPlayerInput 双端
csharp
public static readonly SequenceEventKey WaitForPlayerInputApplyPlayerState 双端
csharp
public static readonly SequenceEventKey ApplyPlayerStateSequenceEventArgs 仅客户端
命名空间 GameCore.ModelAnimation.Struct
csharp
public class SequenceEventArgs : EventArgsProvides data for animation sequence events, containing information about the event context, timing, and the sequence state when the event was triggered.
sequence— The animation sequence that triggered the event.eventKey— The specific event key that was triggered.elapsed— The time elapsed since the sequence started when the event was triggered.playbackIndex— The index of the playback that was active when the event was triggered.animation— The playback animation instance that was active when the event was triggered.
备注
SequenceEventArgs is passed to event handlers when animation sequence events are triggered, providing comprehensive context about the event occurrence. This includes the sequence that triggered the event, the specific event type, timing information, and the current playback state. This information enables event handlers to:
- Identify which sequence triggered the event
- Determine the specific type of event that occurred
- Access timing information for synchronization purposes
- Know which playback within the sequence was active when the event fired
- Make decisions based on the current sequence state The class is immutable by design to ensure event data integrity and prevent accidental modifications during event handling.
构造函数
SequenceEventArgs 仅客户端
csharp
public SequenceEventArgs(AnimationSequence sequence, SequenceEventKey eventKey, TimeSpan elapsed, int playbackIndex, Animation? animation)Provides data for animation sequence events, containing information about the event context, timing, and the sequence state when the event was triggered.
sequence— The animation sequence that triggered the event.eventKey— The specific event key that was triggered.elapsed— The time elapsed since the sequence started when the event was triggered.playbackIndex— The index of the playback that was active when the event was triggered.animation— The playback animation instance that was active when the event was triggered.
备注
SequenceEventArgs is passed to event handlers when animation sequence events are triggered, providing comprehensive context about the event occurrence. This includes the sequence that triggered the event, the specific event type, timing information, and the current playback state. This information enables event handlers to:
- Identify which sequence triggered the event
- Determine the specific type of event that occurred
- Access timing information for synchronization purposes
- Know which playback within the sequence was active when the event fired
- Make decisions based on the current sequence state The class is immutable by design to ensure event data integrity and prevent accidental modifications during event handling.
属性
Sequence 仅客户端
csharp
public AnimationSequence Sequence { get; }Gets the animation sequence that triggered this event.
备注
This property provides access to the sequence that generated the event, allowing event handlers to access sequence-specific data, configuration, or state information. The sequence reference can be used to query additional information about the animation or to control sequence playback in response to the event.
EventKey 仅客户端
csharp
public SequenceEventKey EventKey { get; }Gets the event key that identifies the type of event that was triggered.
备注
This strongly-typed event key allows event handlers to determine exactly which type of event occurred and respond accordingly. The enum-based approach provides compile-time type safety and prevents errors that could occur with string-based event identification. Event handlers typically use this key in switch statements or conditional logic to execute the appropriate response for different event types.
Elapsed 仅客户端
csharp
public TimeSpan Elapsed { get; }Gets the time elapsed since the sequence started when this event was triggered.
备注
This timing information is crucial for synchronization and can be used by event handlers to:
- Coordinate with other time-based systems
- Calculate relative timing for effects or actions
- Determine the exact moment in the sequence timeline when the event occurred
- Implement time-sensitive logic based on sequence progression The elapsed time is measured from the sequence start time, providing a consistent reference point regardless of sequence complexity or playback modifications.
PlaybackIndex 仅客户端
csharp
public int PlaybackIndex { get; }Gets the index of the playback that was active when this event was triggered.
备注
This index corresponds to the position of the active playback in the sequence's Playbacks collection. The playback index is useful for:
- Identifying which specific animation was playing when the event occurred
- Applying playback-specific logic or effects
- Coordinating events with particular animation phases
- Debugging and logging sequence behavior Note that multiple playbacks may be active simultaneously in complex sequences, but this index represents the primary or triggering playback for this specific event.
Animation 仅客户端
csharp
public Animation? Animation { get; }Gets the playback animation instance that was active when this event was triggered.
备注
This property provides access to the animation that was active when the event occurred, allowing event handlers to access animation-specific data or state information.