主题
GameCore.AbilitySystem
Ability 双端
命名空间 GameCore.AbilitySystem
csharp
public class Ability : AttachedObject, IActorScopeOwner, IActorScopeContext, IActorScopePersist, IActorScope, IAttachedObject<Ability, GameDataAbility>, IAttachedObject<GameDataAbility>, IAttachedObject, ISyncIdOwner, IDisposable, IGameObject<GameDataAbility>, IGameObject, IPropertyOwner<PropertyAttachedObject>, IPropertyOwner, ICooldownOwner, IDisplayInfo, IExecutionContext, IPropertyOwner<PropertyAbility>, IResponseOwner挂载在单位上的技能对象,管理技能生命周期、状态和冷却。 可由单位配置或物品授予,支持主动、切换、被动等模式,支持在变形中保持。
构造函数
Ability 双端
csharp
protected internal Ability(Unit host, IGameLink<GameDataAbility> link, Item? item, out Ability ability)Initializes a new ability instance attached to the specified unit.
host— The unit that will own this ability.link— The game data link defining the ability's configuration.item— The item that grants this ability, or null if it's a native ability.ability— Returns the final ability instance after manager processing.
备注
This constructor sets up the ability with all necessary components including modification management, state tracking, cooldown integration, and manager registration. The ability may be processed or modified by the manager before being returned as the final instance.
属性
Stage 仅客户端
csharp
protected OrderStage Stage { get; set; }Only used for client-side ability animation replication.
Manager 双端
csharp
public AbilityManager Manager { get; }Gets the ability manager that owns this ability.
LevelMax 双端
csharp
public uint? LevelMax { get; }Gets the maximum level this ability can reach.
备注
The maximum level determines how many times an ability can be upgraded or improved. Some abilities may not have level restrictions and can be upgraded indefinitely.
IsGrantedByItem 双端
csharp
public bool IsGrantedByItem { get; }Gets a value indicating whether this ability is granted by an item.
备注
Item-granted abilities typically have special behaviors such as persisting through unit transformations and being removed when the item is unequipped or destroyed.
IsPersistDuringMorph 双端
csharp
public virtual bool IsPersistDuringMorph { get; }Gets a value indicating whether this ability persists when the unit undergoes morphing or transformation.
备注
Abilities can be configured to persist through unit transformations either through explicit configuration or by being granted by items. This is important for maintaining unit capabilities during temporary transformation effects.
ShouldPersistDuringMorph 双端
csharp
public bool ShouldPersistDuringMorph { get; set; }Gets or sets a value indicating whether this ability should persist during morphing operations.
备注
This property controls whether the ability remains accessible when the unit is transformed. It can be set either from the ability's configuration data or modified dynamically.
Paused 双端
csharp
public bool Paused { get; }Gets a value indicating whether the ability is currently paused.
备注
Paused abilities do not execute their periodic effects or update their states. This is used for temporarily suspending ability functionality without removing the ability.
SyncIdType 双端
csharp
public override SyncIdType SyncIdType { get; }Gets the synchronization ID type for this ability.
DisableOnDeath 双端
csharp
public bool DisableOnDeath { get; }Link 双端
csharp
public IGameLink<GameDataAbility> Link { get; set; }Cache 双端
csharp
public GameDataAbility Cache { get; set; }IsLinkEnabled 双端
csharp
public override bool IsLinkEnabled { get; }DisplayCache 双端
csharp
public override IDisplayInfoData DisplayCache { get; }Item 双端
csharp
public Item? Item { get; }Level 双端
csharp
public uint Level { get; }方法
OnAnimationState 仅客户端
csharp
protected virtual void OnAnimationState(OrderStage stage, OrderStage previousStage)ReplicateFromKeyValue 仅客户端
csharp
public override bool ReplicateFromKeyValue(System.Enum propertyEnum, ReadOnlySpan<byte> value, bool isHostReplicating = false)Replace 双端
csharp
public virtual bool Replace(IGameLink<GameDataAbility> link)Replaces the current ability's data configuration with a new data link.
link— The new ability data link to apply to this ability.
返回: True if the replacement was successful; otherwise, false.
备注
This method allows dynamic modification of ability behavior by changing its underlying data configuration. The replacement will fail if the provided link contains invalid data. This is useful for ability evolution, morphing effects, or item-based ability modifications.
ToString 双端
csharp
public override string? ToString()Returns a string representation of this ability.
返回: A formatted string containing the ability's type, friendly name, and sync ID.
DisposeManaged 双端
csharp
protected override void DisposeManaged()Releases managed resources used by this ability.
备注
This method cleans up all ability resources including timers, event handlers, cooldowns, and manager registrations. It ensures proper cleanup when the ability is removed from its host.
GetProperty 双端
csharp
public TValue? GetProperty<TValue>(PropertyAbility property)HasState 仅客户端
csharp
public override bool HasState(AttachedObjectState state)SetProperty 仅服务端
csharp
public void SetProperty<TValue>(PropertyAbility property, TValue value)AddProperty 仅服务端
csharp
public void AddProperty(PropertyAbility property, double value)事件
OnPropertyChanged 双端
csharp
public event Action<PropertyAbility>? OnPropertyChanged当技能属性发生变化时触发(服务端:SetProperty/AddProperty,客户端:属性复制)。 适用场景:UI 层监听特定技能实例的属性变化(如自动施法开关、等级变化)。 直接订阅到对象上,无需过滤,生命周期跟随技能实例。 替代方案: EventAbilityPropertyChange — Trigger 事件,适合游戏逻辑中跨单位全局监听所有技能属性变化 OnAttachedObjectStateChanged — 仅关注 Disabled/Deactivated/Hidden 状态切换时使用
AbilityActive 双端
命名空间 GameCore.AbilitySystem
csharp
public abstract class AbilityActive : Ability, ICostSpender, ICooldownOwner, IPropertyOwner, ISyncIdOwner, IDisplayInfo, IGameObject<GameDataAbilityActive>, IGameObject表示具有主动行为的技能(Ability),支持多段、冷却等机制。
构造函数
AbilityActive 双端
csharp
protected internal AbilityActive(Unit owner, IGameLink<GameDataAbilityActive> link, Item? item, out Ability ability)属性
SwingController 仅客户端
csharp
protected virtual IAnimationSwingController? SwingController { get; set; }Cooldown 双端
csharp
public CooldownActive? Cooldown { get; }获取主动技能的冷却对象。
Charge 双端
csharp
public CooldownCharge? Charge { get; }获取主动技能的充能对象。
PhaseInfo 双端
csharp
public PhaseContext? PhaseInfo { get; set; }获取或设置阶段信息。
IsMultiPhase 双端
csharp
public bool IsMultiPhase { get; }指示该技能是否为多阶段技能。
Link 双端
csharp
public new IGameLink<GameDataAbilityActive> Link { get; }Cache 双端
csharp
public new GameDataAbilityActive Cache { get; }WaitForOnCooldownAffordable 仅服务端
csharp
public EventWaiter WaitForOnCooldownAffordable { get; }WaitForOnChargeAffordable 仅服务端
csharp
public EventWaiter WaitForOnChargeAffordable { get; }方法
EnsureSwingController 仅客户端
csharp
protected virtual IAnimationSwingController? EnsureSwingController()OnAnimationState 仅客户端
csharp
protected override void OnAnimationState(OrderStage stage, OrderStage previousStage)GetCooldown 双端
csharp
public Cooldown? GetCooldown(CooldownType type)根据类型获取对应的冷却对象。
type— 冷却类型。
返回: 对应的冷却对象或 null。
DisposeManaged 双端
csharp
protected override void DisposeManaged()TryGetSkillTestEffectiveCast 仅客户端
csharp
public bool TryGetSkillTestEffectiveCast(out SkillTestTarget? target, out long revision, out SkillTestCastDurations durations)Reports the authoritative durations frozen for the active debug cast, not pending edits.
Replace 仅服务端
csharp
public override bool Replace(IGameLink<GameDataAbility> link)替换当前技能的数据链接,仅支持主动技能类型。
link— 新的技能数据链接。
返回: 替换成功返回 true,否则返回 false。
SetPhase 仅服务端
csharp
public virtual void SetPhase(int phase)设置当前技能的阶段。
phase— 阶段索引。
SpendPhase 仅服务端
csharp
public virtual void SpendPhase()消耗当前阶段。
AddPhase 仅服务端
csharp
public virtual void AddPhase(int delta)增加阶段索引。
delta— 增加的阶段数。
OnPhaseChanged 仅服务端
csharp
protected virtual void OnPhaseChanged()阶段变化时的回调。
事件
OnCooldownAffordable 仅服务端
csharp
public event Action? OnCooldownAffordableOnChargeAffordable 仅服务端
csharp
public event Action? OnChargeAffordableAbilityExecute 双端
命名空间 GameCore.AbilitySystem
csharp
public class AbilityExecute : AbilityActive, IGameObject<GameDataAbilityExecute>, IGameObject, ITargetingInfo表示可执行的技能,如主动技能、攻击技能等。 继承自 AbilityActive,提供即时执行的技能功能。
备注
该类是技能系统中最常用的技能类型,用于实现各种主动释放的技能。 攻击技能也是通过此类实现,通过设置 IsAttack 标志来区分。
构造函数
AbilityExecute 双端
csharp
protected internal AbilityExecute(Unit owner, IGameLink<GameDataAbilityExecute> link, Item? item, out Ability ability)属性
IsAutoCastOn 双端
csharp
public bool IsAutoCastOn { get; }运行时自动施法开关。仅当 AcquireSettings 的 AutoCast 为 true 时有效。 客户端只读,服务端可读写。
IsAttack 双端
csharp
public bool IsAttack { get; }获取技能是否为攻击技能。 重要:只有当数编表中的 IsAttack 设置为 true 时,该技能才能被 Attack 指令使用。
Range 双端
csharp
public float Range { get; }获取技能的有效范围。 该值由数编表中的 Range 函数计算得出。
AlwaysAcquireTarget 双端
csharp
public bool AlwaysAcquireTarget { get; }获取无目标和向量目标技能是否总是获取目标。 该属性仅对 None 和 Vector 目标类型的技能生效。 对于其他目标类型的技能,此属性始终返回 true。
Link 双端
csharp
public new IGameLink<GameDataAbilityExecute> Link { get; }Cache 双端
csharp
public new GameDataAbilityExecute Cache { get; }ActorScope 双端
csharp
public IActorScope ActorScope { get; }Source 双端
csharp
public ITarget Source { get; }VectorConeAngle 双端
csharp
public Angle? VectorConeAngle { get; }CursorRadius 双端
csharp
public float? CursorRadius { get; }VectorLineWidth 双端
csharp
public float? VectorLineWidth { get; }AllowApproachBeyondRange 双端
csharp
public bool AllowApproachBeyondRange { get; }TargetingHighlightFilter 双端
csharp
public TargetFilterComplex? TargetingHighlightFilter { get; }VectorHighlightLimit 双端
csharp
public uint? VectorHighlightLimit { get; }方法
Replace 双端
csharp
public override bool Replace(IGameLink<GameDataAbility> link)替换当前技能的数据链接。 只有当新链接指向的是 GameDataAbilityExecute 类型的数据时才能成功替换。
link— 新的技能数据链接。
返回: 如果替换成功返回 true;否则返回 false。
DisposeManaged 仅服务端
csharp
protected override void DisposeManaged()AbilityMorph 双端
命名空间 GameCore.AbilitySystem
csharp
public class AbilityMorph : AbilityToggle, IGameObject<GameDataAbilityMorph>, IGameObject构造函数
AbilityMorph 双端
csharp
protected internal AbilityMorph(Unit owner, IGameLink<GameDataAbilityMorph> link, Item? item, out Ability ability)属性
IsPersistDuringMorph 双端
csharp
public override bool IsPersistDuringMorph { get; }变形技能在开启状态下不会被变形操作移除。
Link 双端
csharp
public new IGameLink<GameDataAbilityMorph> Link { get; }Cache 双端
csharp
public new GameDataAbilityMorph Cache { get; }方法
ToggleOnUnchecked 仅服务端
csharp
protected override void ToggleOnUnchecked(IExecutionContext context)ToggleOffUnchecked 仅服务端
csharp
protected override void ToggleOffUnchecked(IExecutionContext context)Replace 仅服务端
csharp
public override bool Replace(IGameLink<GameDataAbility> link)AbilityToggle 双端
命名空间 GameCore.AbilitySystem
csharp
public class AbilityToggle : AbilityActive, IGameObject<GameDataAbilityToggle>, IGameObject构造函数
AbilityToggle 双端
csharp
protected internal AbilityToggle(Unit owner, IGameLink<GameDataAbilityToggle> link, Item? item, out Ability ability)属性
ToggledOn 双端
csharp
public bool ToggledOn { get; }Link 双端
csharp
public new IGameLink<GameDataAbilityToggle> Link { get; }Cache 双端
csharp
public new GameDataAbilityToggle Cache { get; }方法
DisposeManaged 双端
csharp
protected override void DisposeManaged()Toggle 仅服务端
csharp
public bool Toggle()Toggle 仅服务端
csharp
public bool Toggle(bool on)ToggleOnUnchecked 仅服务端
csharp
protected virtual void ToggleOnUnchecked(IExecutionContext context)Does not check if the ability is already toggled on
context—
ToggleOffUnchecked 仅服务端
csharp
protected virtual void ToggleOffUnchecked(IExecutionContext context)Does not check if the ability is already toggled off. State change triggers DeactivatedEffect from the base class.
Replace 仅服务端
csharp
public override bool Replace(IGameLink<GameDataAbility> link)OnDisabledTurnOff 仅服务端
csharp
protected virtual void OnDisabledTurnOff()SpendPhase 仅服务端
csharp
public override void SpendPhase()GameDataAbility 双端
命名空间 GameCore.AbilitySystem.Data
csharp
public class GameDataAbility : GameDataCategory<GameDataAbility>, IAttachedData<GameDataAbility>, IAttachedData, IGameData<GameDataAbility>, IGameData, IUnitModificationData, IResponseOwnerData, IGameDataActorScopeOwner, IGameData<IGameDataActorScopeOwner>, IDisplayInfoData, IEventSender, IGameDataActorScope, IGameDataCategory<GameDataAbility>表示游戏中技能(Ability)的数据定义,包括技能的显示信息、属性修改、状态变更、响应、图标等。 用于驱动技能的创建、同步、被动效果、目标类型等核心逻辑。
构造函数
GameDataAbility 双端
csharp
public GameDataAbility(GameLink<GameDataAbility, GameDataAbility> link)GameDataAbility 双端
csharp
public GameDataAbility(IGameLink<GameDataAbility> link)属性
DisplayName 双端
csharp
public LocalizedString? DisplayName { get; set; }技能的本地化显示名称。
Description 双端
csharp
public LocalizedString? Description { get; set; }技能的本地化描述。
SyncType 双端
csharp
public SyncType SyncType { get; set; }技能的同步类型,决定同步范围(如自身或视野内)。
Flags 双端
csharp
public AbilityFlags Flags { get; set; }技能的标志位,控制技能的特殊行为(如被动、可切换等)。
PassivePeriod 双端
csharp
public FuncTime? PassivePeriod { get; set; }被动技能的周期(如定时触发)。
PassivePeriodicEffect 双端
csharp
public IGameLink<GameDataEffect>? PassivePeriodicEffect { get; set; }被动周期性触发的效果。
ActivatedEffect 双端
csharp
public IGameLink<GameDataEffect>? ActivatedEffect { get; set; }技能变为激活状态时执行的效果(瞬发,基于技能上下文)。 对被动技能:技能附加且启用时触发。 对切换技能:Toggle On 时触发。 与 Modifications/AddStates 使用相同的激活语义。
DeactivatedEffect 双端
csharp
public IGameLink<GameDataEffect>? DeactivatedEffect { get; set; }技能变为停用状态时执行的效果(瞬发,基于技能上下文)。 对被动技能:技能禁用或移除时触发。 对切换技能:Toggle Off 或被沉默/禁用时触发。
LevelMax 双端
csharp
public uint? LevelMax { get; set; }技能的最大等级。
TargetType 双端
csharp
public AbilityTargetType TargetType { get; set; }技能的目标类型(如单体、范围、自身等)。
Categories 双端
csharp
public List<AbilityCategory> Categories { get; set; }技能所属的分类列表。
Modifications 双端
csharp
public List<UnitPropertyModification> Modifications { get; set; }技能对单位属性的修改列表。
AddStates 双端
csharp
public List<UnitState> AddStates { get; set; }技能添加的单位状态列表。
RemoveStates 双端
csharp
public List<UnitState> RemoveStates { get; set; }技能移除的单位状态列表。
ImmuneStates 双端
csharp
public List<UnitState> ImmuneStates { get; set; }技能赋予免疫的单位状态列表。
Responses 双端
csharp
public List<IGameLink<GameDataResponse>?>? Responses { get; set; }技能触发的响应(如被动触发、命中触发等)。
Icon 双端
csharp
public Icon? Icon { get; set; }技能的图标信息。
ActorArray 双端
csharp
public List<IGameLink<GameDataActor>?>? ActorArray { get; set; }技能相关的特效/表现Actor数组。
AggregatorWeakReference 双端
csharp
public WeakReference<EventAggregator> AggregatorWeakReference { get; }DebugDrawSettings 双端
csharp
public DebugDrawSettings? DebugDrawSettings { get; set; }方法
CreateAbility 双端
csharp
public virtual Ability CreateAbility(Unit owner, Item? item = null)创建技能实例。
owner— 技能所属单位。item— (可选)技能关联的物品。
返回: 新建的Ability实例。
Replicate 仅客户端
csharp
public IAttachedObject Replicate(ICooldownHost host, int? syncId)客户端复制技能对象,用于同步。
host— 冷却宿主。syncId— 同步ID。
返回: 复制的技能对象。
GameDataAbilityActive 双端
命名空间 GameCore.AbilitySystem.Data
csharp
public abstract class GameDataAbilityActive : GameDataAbility, IGameData<GameDataAbilityActive>, IGameData主动技能的数据基类,定义施法时间、消耗、效果和视觉表现
构造函数
GameDataAbilityActive 双端
csharp
public GameDataAbilityActive(GameLink<GameDataAbility, GameDataAbilityActive> link)GameDataAbilityActive 双端
csharp
public GameDataAbilityActive(IGameLink<GameDataAbilityActive> link)属性
Effect 双端
csharp
public IGameLink<GameDataEffect>? Effect { get; set; }技能施放时执行的效果
AbilityActiveFlags 双端
csharp
public AbilityActiveFlags AbilityActiveFlags { get; set; }SpellInterruptConfig 双端
csharp
public SpellInterruptConfig SpellInterruptConfig { get; set; }施法中断配置,定义哪些行为会打断施法
Time 双端
csharp
public SpellCastTime Time { get; set; }施法时间配置(前摇、引导、后摇等阶段的时长)
LogExecutionFailure 双端
csharp
public bool LogExecutionFailure { get; set; }是否在效果执行失败时记录日志
Cost 双端
csharp
public Cost? Cost { get; set; }技能的施放消耗(如魔法值、能量等资源)
AbilityPhaseSettings 双端
csharp
public List<AbilityPhaseSetting> AbilityPhaseSettings { get; set; }多阶段技能的各阶段配置列表(如蓄力技能的不同阶段)
StagedSpawns 双端
csharp
public List<AbilityStageSpawn>? StagedSpawns { get; set; }Gets or sets the list of staged actor spawns that define when visual effects and other actors are created and destroyed during ability execution.
备注
This property allows fine-grained control over the lifecycle of visual effects, projectiles, and other actors throughout the ability's execution phases. Each AbilityStageSpawn entry defines a set of actors to spawn at a specific stage and when to clean them up. The ability execution follows these stages in order: Preswing → Cast → Channel → Backswing → Left. Common usage patterns: Preswing effects (charge-up visuals): Spawn at Preswing, clear at Cast Cast effects (main spell visuals): Spawn at Cast, clear at Backswing or Left Channel effects (sustained visuals): Spawn at Channel, clear at Backswing Persistent effects: Spawn at Cast, clear at Left (or rely on transient cleanup) Transient actors (those with IsTransient = true) are automatically cleaned up and ignore the ClearStage setting. All remaining actors are forcibly cleaned up when the ability reaches the Left stage to prevent memory leaks.
Animation 双端
csharp
public List<IGameLink<GameDataAnimation>?>? Animation { get; set; }If set, the animation will be played when the ability is casting. When multiple animations are provided, a random one will be selected for each cast.
Link 双端
csharp
public new IGameLink<GameDataAbilityActive> Link { get; }GameDataAbilityExecute 双端
命名空间 GameCore.AbilitySystem.Data
csharp
public class GameDataAbilityExecute : GameDataAbilityActive, IGameData<GameDataAbilityExecute>, IGameData可执行技能的数编表数据,用于配置主动技能和攻击技能的各种属性和行为。 该类定义了技能的执行参数、目标获取设置、范围计算等核心配置。
备注
该数编表是技能系统中最重要的配置类之一,通过 Item) 方法创建 AbilityExecute 实例。 攻击技能配置:要使技能能够被攻击指令使用,必须设置 AbilityExecuteFlags.IsAttack = true。
构造函数
GameDataAbilityExecute 双端
csharp
public GameDataAbilityExecute(GameLink<GameDataAbility, GameDataAbilityExecute> link)GameDataAbilityExecute 双端
csharp
public GameDataAbilityExecute(IGameLink<GameDataAbilityExecute> link)属性
AbilityExecuteFlags 双端
csharp
public AbilityExecuteFlags AbilityExecuteFlags { get; set; }获取或设置技能的执行标志配置。 重要:IsAttack 标志决定了技能是否能被攻击指令使用。
备注
这是攻击技能配置的关键属性。如果要创建攻击技能,必须设置: AbilityExecuteFlags = new AbilityExecuteFlags
Arc 双端
csharp
public Angle Arc { get; set; }获取或设置技能的作用弧度。 定义技能影响的角度范围,通常用于扇形攻击或锥形技能。
ArcSlop 双端
csharp
public Angle ArcSlop { get; set; }获取或设置技能弧度的容差角度。 用于在目标获取时提供一定的角度容差,提升游戏体验。
Range 双端
csharp
public FuncFloat Range { get; set; }获取或设置技能的有效范围计算函数。 该函数接收技能实例作为参数,返回技能的有效作用距离。
备注
该函数在运行时被调用以动态计算技能范围,可以根据技能等级、装备等因素进行调整。
TargetingIndicatorInfo 双端
csharp
public TargetingIndicatorInfo? TargetingIndicatorInfo { get; set; }获取或设置技能的目标指示器信息。 用于配置技能在选择目标时的视觉提示和交互行为。
AcquireSettings 双端
csharp
public AcquireSettings AcquireSettings { get; set; }获取或设置技能的目标获取设置。 配置技能如何选择和过滤目标,包括目标类型过滤器等。
Link 双端
csharp
public new IGameLink<GameDataAbilityExecute> Link { get; }方法
CreateAbility 双端
csharp
public override Ability CreateAbility(Unit owner, Item? item = null)创建技能实例。 根据当前数编表配置创建一个 AbilityExecute 技能实例。
owner— 技能的拥有者单位。item— 关联的物品(可选),通常用于装备技能。
返回: 创建的技能实例。
备注
该方法是技能系统的工厂方法,由框架在添加技能时自动调用。
GameDataAbilityMorph 双端
命名空间 GameCore.AbilitySystem.Data
csharp
public class GameDataAbilityMorph : GameDataAbilityToggle, IGameDataMorph, IGameData<GameDataAbilityMorph>, IGameData变身技能,开启时将单位变形为另一个单位形态
构造函数
GameDataAbilityMorph 双端
csharp
public GameDataAbilityMorph(GameLink<GameDataAbility, GameDataAbilityMorph> link)GameDataAbilityMorph 双端
csharp
public GameDataAbilityMorph(IGameLink<GameDataAbilityMorph> link)属性
MorphUnit 双端
csharp
public IGameLink<GameDataUnit> MorphUnit { get; set; }变身后的目标单位数据
MorphFlags 双端
csharp
public MorphFlags MorphFlags { get; set; }Link 双端
csharp
public new IGameLink<GameDataAbilityMorph> Link { get; }方法
CreateAbility 双端
csharp
public override Ability CreateAbility(Unit owner, Item? item = null)GameDataAbilityToggle 双端
命名空间 GameCore.AbilitySystem.Data
csharp
public class GameDataAbilityToggle : GameDataAbilityActive, IGameData<GameDataAbilityToggle>, IGameData开关型技能,具有开启/关闭两种状态。 开启时执行 ActivatedEffect(基类),关闭时执行 DeactivatedEffect(基类)。
构造函数
GameDataAbilityToggle 双端
csharp
public GameDataAbilityToggle(GameLink<GameDataAbility, GameDataAbilityToggle> link)GameDataAbilityToggle 双端
csharp
public GameDataAbilityToggle(IGameLink<GameDataAbilityToggle> link)属性
IconOff 双端
csharp
public Icon? IconOff { get; set; }技能关闭状态时的图标
ToggleFlags 双端
csharp
public AbilityToggleFlags ToggleFlags { get; set; }Link 双端
csharp
public new IGameLink<GameDataAbilityToggle> Link { get; }方法
CreateAbility 双端
csharp
public override Ability CreateAbility(Unit owner, Item? item = null)AbilityCategory 双端
命名空间 GameCore.AbilitySystem.Data.Enum
csharp
public readonly struct AbilityCategory : IGameClass, IExtendableEnum<AbilityCategory>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(AbilityCategory left, AbilityCategory right)operator != 双端
csharp
public static bool operator !=(AbilityCategory left, AbilityCategory 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 InnerValueCanBeDisabled 双端
csharp
public static readonly AbilityCategory CanBeDisabledCanBeSilenced 双端
csharp
public static readonly AbilityCategory CanBeSilencedAbilitySpawnStage 双端
命名空间 GameCore.AbilitySystem.Data.Enum
csharp
public enum AbilitySpawnStageDefines the execution stages during an ability's lifecycle for controlling when actors are spawned and cleared.
备注
These stages correspond to the different phases of ability execution, allowing precise timing control for visual effects, audio, projectiles, and other actors. The stages progress in a fixed order during ability execution. Stage progression: Preswing → Cast → Channel → Backswing → Left Not all abilities use every stage. For example, instant abilities may skip Channel, while non-channeled abilities will have minimal or no Channel duration.
枚举值
Preswing— The preparation phase before the main ability execution begins.Cast— The main execution phase where the ability's primary effect occurs.Channel— The sustained execution phase for channeled or continuous abilities.Backswing— The recovery phase after the main ability execution completes.Left— The final stage when the ability execution is completely finished.
AbilityTargetType 双端
命名空间 GameCore.AbilitySystem.Data.Enum
csharp
public enum AbilityTargetType枚举值
NoneUnitGroundUnitOrGroundVectorInteract
AbilityActiveFlags 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityActiveFlagsGameDataAbilityActive 的行为标志配置。 控制技能指令的调度方式、使用条件和验证行为。
构造函数
AbilityActiveFlags 双端
csharp
public AbilityActiveFlags()属性
Transient 双端
csharp
public bool Transient { get; set; }瞬态技能。设为 true 时,技能指令入队后立即执行,不打断当前正在进行的行为(移动、攻击等)。 典型用途:无敌、解控等需要立刻生效但不应中断操作流程的技能。
备注
服务端运行时对应 Order.IsTransient。
AllowEnqueueInCooldown 双端
csharp
public bool AllowEnqueueInCooldown { get; set; }是否可以在冷却中下达指令,用于技能的连续释放,技能依然需要等待冷却完成才能进入前摇
SkipEffectPreValidation 双端
csharp
public bool SkipEffectPreValidation { get; set; }跳过指令入队时对子效果树的预验证。预验证使用 Ability(而非 Order)作为执行上下文, 导致 Shared.MainTarget 不准确(回退为 Caster 而非真实目标)。 如果效果树中的 Validator 或 TargetLocationExpression 依赖 MainTarget,有两种规避方式: 设置此标志,完全跳过效果预验证 在自定义 Validator 中检查 effect.IsPreValidatorOnly,对预验证阶段走不同的验证分支
AbilityExecuteFlags 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityExecuteFlags技能执行标志配置,用于控制技能的执行行为和特性。 这些标志决定了技能如何与指令系统交互,特别是攻击指令的处理方式。
构造函数
AbilityExecuteFlags 双端
csharp
public AbilityExecuteFlags()属性
InfiniteCasting 双端
csharp
public bool InfiniteCasting { get; set; }获取或设置技能是否可以无限施法。 当设置为 true 时,技能可以持续施法而不会自动停止。
备注
TODO: SCE-19755 InfiniteCasting https://xindong.atlassian.net/browse/SCE-19755
IsAttack 双端
csharp
public bool IsAttack { get; set; }获取或设置技能是否为攻击技能。 重要:只有设置为 true 的技能才能被 Attack 指令使用。 攻击指令会自动查找单位的第一个有效攻击技能(IsAttack = true)来执行攻击。
AlwaysAcquireTarget 双端
csharp
public bool AlwaysAcquireTarget { get; set; }获取或设置无目标和向量目标技能是否总是获取目标。 仅对 None 和 Vector 目标类型的技能生效。
Reapproachable 双端
csharp
public bool Reapproachable { get; set; }获取或设置技能是否可以重新接近目标。 进入 Channel 前若目标超出射程,则回到 Approach,接近后重新执行完整的前摇和出手。
备注
每轮起手都会发送 Preswing、Cast 阶段事件,并清理上一轮动画与阶段表现; 仅最终进入 Channel 时扣除消耗、开始冷却并发动效果,Channel 之后不会回跳。 同一指令保留首次前摇锁定的点或向量瞄准快照,单位及交互目标继续实时追踪。 无法移动、目标失效或其它执行条件不满足时取消指令。
AbilityFlags 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityFlags构造函数
AbilityFlags 双端
csharp
public AbilityFlags()属性
Hidden 双端
csharp
public bool Hidden { get; set; }PersistDuringMorph 双端
csharp
public bool PersistDuringMorph { get; set; }Decides if the ability will be removed from the unit when the unit morphs. Morphing will remove all abilities that are not persistent, except for the morph ability itself, and any other morph abilities that are toggled on at that point.
DisplayDescriptionOnLongClick 双端
csharp
public bool DisplayDescriptionOnLongClick { get; set; }DisableWhenDead 双端
csharp
public bool DisableWhenDead { get; set; }If true, the ability will be disabled when the unit dies.
AbilityPhaseSetting 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityPhaseSetting构造函数
AbilityPhaseSetting 双端
csharp
public AbilityPhaseSetting()属性
ResetDuration 双端
csharp
public FuncTime? ResetDuration { get; set; }AutoIncreasePhase 双端
csharp
public bool AutoIncreasePhase { get; set; }Link 双端
csharp
public required IGameLink<GameDataAbility> Link { get; set; }AbilityStageSpawn 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityStageSpawnDefines a group of actors that should be spawned and cleared at specific stages during ability execution.
备注
This class represents a single staging rule for actor lifecycle management during ability execution. It allows precise control over when visual effects, projectiles, and other actors are created and destroyed throughout the ability's execution phases. The lifecycle works as follows: When the ability reaches SpawnStage, all actors in Spawns are created When the ability reaches ClearStage, all non-transient actors from this spawn group are destroyed Transient actors ignore ClearStage and are cleaned up automatically by the system Any remaining actors are forcibly cleaned up when the ability reaches the Left stage
构造函数
AbilityStageSpawn 双端
csharp
public AbilityStageSpawn()属性
Spawns 双端
csharp
public required List<IGameLink<GameDataActor>> Spawns { get; set; }Gets or sets the list of actor data links that define which actors should be spawned for this staging rule.
备注
Each actor in this list will be instantiated when the ability reaches the SpawnStage. The created actors will be tracked for cleanup unless they are marked as transient. Common actor types include: Visual Effects: Particle systems, lighting effects, magical auras Audio Effects: Sound effects, ambient audio loops Projectiles: Missiles, beams, area-of-effect markers Temporary Objects: Magic circles, targeting indicators, spell components
SpawnStage 双端
csharp
public AbilitySpawnStage SpawnStage { get; set; }Gets or sets the ability stage at which the actors in Spawns will be instantiated.
备注
This determines when during the ability execution the actors will be created. The ability progresses through stages in this order: Preswing → Cast → Channel → Backswing → Left. Common spawn timing strategies: Preswing: For charge-up effects, wind-up animations, or preparation visuals Cast: For main spell effects, projectiles, or primary visual/audio feedback Channel: For sustained effects during channeled abilities Backswing: For follow-up effects, recovery animations, or aftermath visuals Left: Rarely used for spawning, mainly for cleanup
ClearStage 双端
csharp
public AbilitySpawnStage ClearStage { get; set; }Gets or sets the ability stage at which non-transient actors from Spawns will be destroyed.
备注
This controls when the spawned actors are cleaned up. Only non-transient actors are affected by this setting; transient actors are automatically cleaned up by the system and ignore this property. Common cleanup timing strategies: Cast: Clean up preswing effects when the main cast begins Channel: Clean up cast effects when channeling starts (for channeled spells) Backswing: Clean up main effects when entering recovery phase Left: Keep effects until the ability completely finishes (most persistent effects) Important: All remaining actors are forcibly cleaned up when the ability reaches the Left stage, regardless of this setting, to prevent memory leaks.
AbilityToggleFlags 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class AbilityToggleFlags构造函数
AbilityToggleFlags 双端
csharp
public AbilityToggleFlags()属性
ToggledOn 双端
csharp
public bool ToggledOn { get; set; }TargetingIndicatorInfo 双端
命名空间 GameCore.AbilitySystem.Data.Struct
csharp
public class TargetingIndicatorInfo构造函数
TargetingIndicatorInfo 双端
csharp
public TargetingIndicatorInfo()属性
TargetingIndicator 双端
csharp
public IGameLink<GameDataTargetingIndicator>? TargetingIndicator { get; set; }VectorConeAngle 双端
csharp
public FuncAngle? VectorConeAngle { get; set; }CursorRadius 双端
csharp
public FuncFloat? CursorRadius { get; set; }VectorLineWidth 双端
csharp
public FuncFloat? VectorLineWidth { get; set; }VectorHighlightLimit 双端
csharp
public FuncUInt? VectorHighlightLimit { get; set; }Gets or sets the function that determines the maximum number of vector line highlights to display. Only works when the targeting indicator have highlight actors set;
备注
Use this property to define a custom logic for limiting the number of vector highlights. Setting this property to null indicates that all vector highlights will be displayed without restriction.
PropertyAbility 双端
命名空间 GameCore.AbilitySystem.Enum
csharp
public readonly struct PropertyAbility : IGameClass, IExtendableEnum<PropertyAbility>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(PropertyAbility left, PropertyAbility right)operator != 双端
csharp
public static bool operator !=(PropertyAbility left, PropertyAbility 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 InnerValueItem 双端
csharp
public static readonly PropertyAbility ItemCooldown 双端
csharp
public static readonly PropertyAbility CooldownCharge 双端
csharp
public static readonly PropertyAbility ChargePhase 双端
csharp
public static readonly PropertyAbility PhaseCastingStage 双端
csharp
public static readonly PropertyAbility CastingStageCastingTotalTime 双端
csharp
public static readonly PropertyAbility CastingTotalTimeLevel 双端
csharp
public static readonly PropertyAbility LevelIsDeactivated 双端
csharp
public static readonly PropertyAbility IsDeactivatedIsDisabled 双端
csharp
public static readonly PropertyAbility IsDisabledAutoCastOn 双端
csharp
public static readonly PropertyAbility AutoCastOnSkillTestCast 双端
csharp
public static readonly PropertyAbility SkillTestCastPropertyAbilityNumeric 双端
命名空间 GameCore.AbilitySystem.Enum
csharp
public readonly struct PropertyAbilityNumeric : IGameClass, IExtendableEnum<PropertyAbilityNumeric>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(PropertyAbilityNumeric left, PropertyAbilityNumeric right)operator != 双端
csharp
public static bool operator !=(PropertyAbilityNumeric left, PropertyAbilityNumeric right)Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()implicit operator 双端
csharp
public static PropertyAbility implicit operator(PropertyAbilityNumeric e)字段
InnerValue 双端
csharp
public readonly System.Enum InnerValueCustomValue 双端
csharp
public static readonly PropertyAbilityNumeric CustomValueAbilityManager 双端
命名空间 GameCore.AbilitySystem.Manager
csharp
public class AbilityManager : ObjectManager<Ability, GameDataAbility>, IThinkerStaggered, IContextTypeService<Entity, AbilityManager>, ICommandHandler构造函数
AbilityManager 双端
csharp
public AbilityManager(Entity host)属性
ObjectType 双端
csharp
public override AttachedType ObjectType { get; }StaggeredCount 仅服务端
csharp
public int StaggeredCount { get; }方法
CreateInstance 双端
csharp
public static AbilityManager CreateInstance(Entity content)HasAbility 双端
csharp
public bool HasAbility(IGameLink<GameDataAbility> abilityLink)检查是否有指定的技能
abilityLink— 技能数编Link
返回: 如果存在指定技能则返回true
HasAnyAbility 双端
csharp
public bool HasAnyAbility(params IGameLink<GameDataAbility>[] abilityLinks)检查是否有任意一个指定的技能
abilityLinks— 技能数编Link数组
返回: 如果存在任意一个指定技能则返回true
HasAllAbilities 双端
csharp
public bool HasAllAbilities(params IGameLink<GameDataAbility>[] abilityLinks)检查是否有所有指定的技能
abilityLinks— 技能数编Link数组
返回: 如果存在所有指定技能则返回true
GetActivatedAbilities 双端
csharp
public IEnumerable<Ability> GetActivatedAbilities()获取所有激活的技能
返回: 激活的技能集合
GetEnabledAbilities 双端
csharp
public IEnumerable<Ability> GetEnabledAbilities()获取所有启用的技能
返回: 启用的技能集合
GetAbilitiesByTargetType 双端
csharp
public IEnumerable<Ability> GetAbilitiesByTargetType(AbilityTargetType targetType)获取指定目标类型的技能
targetType— 技能目标类型
返回: 指定目标类型的技能集合
GetPassiveAbilities 双端
csharp
public IEnumerable<Ability> GetPassiveAbilities()获取所有被动技能(非AbilityActive的技能)
返回: 被动技能集合
GetActiveAbilities 双端
csharp
public IEnumerable<Ability> GetActiveAbilities()获取所有主动技能(AbilityActive类型的技能)
返回: 主动技能集合
RemoveByPredicate 双端
csharp
public int RemoveByPredicate(Func<Ability, bool> predicate)按条件移除技能
predicate— 移除条件
返回: 移除的技能数量
CountAbilities 双端
csharp
public int CountAbilities(Func<Ability, bool> predicate)统计指定类型的技能数量
predicate— 统计条件
返回: 满足条件的技能数量
CountAbilitiesByTargetType 双端
csharp
public int CountAbilitiesByTargetType(AbilityTargetType targetType)统计指定目标类型的技能数量
targetType— 技能目标类型
返回: 指定目标类型的技能数量
CountPassiveAbilities 双端
csharp
public int CountPassiveAbilities()统计被动技能数量
返回: 被动技能数量
CountActiveAbilities 双端
csharp
public int CountActiveAbilities()统计主动技能数量
返回: 主动技能数量
CountActivatedAbilities 双端
csharp
public int CountActivatedAbilities()统计激活技能数量
返回: 激活技能数量
IsAbilityActivated 双端
csharp
public bool IsAbilityActivated(IGameLink<GameDataAbility> abilityLink)检查指定技能是否激活
abilityLink— 技能数编Link
返回: 如果技能激活则返回true
IsAbilityEnabled 双端
csharp
public bool IsAbilityEnabled(IGameLink<GameDataAbility> abilityLink)检查指定技能是否启用
abilityLink— 技能数编Link
返回: 如果技能启用则返回true
GetValidAttacks 双端
csharp
public IEnumerable<AbilityExecute> GetValidAttacks()获取单位的所有有效攻击技能。 有效攻击技能必须同时满足以下条件: IsAttack = true (在数编表中设置 IsAttack = true) IsValid = true (技能有效) IsEnabled = true (技能启用)
返回: 所有满足条件的攻击技能的枚举。如果没有有效的攻击技能,返回空枚举。
备注
该方法用于攻击指令系统查找可用的攻击技能。攻击指令会按顺序尝试这些技能。
GetValidAttack 双端
csharp
public AbilityExecute? GetValidAttack()获取单位的第一个有效攻击技能。 有效攻击技能必须同时满足以下条件: IsAttack = true (在数编表中设置 IsAttack = true) IsValid = true (技能有效) IsEnabled = true (技能启用)
返回: 第一个满足条件的攻击技能,如果没有有效的攻击技能则返回 null。
备注
这是攻击指令系统最常用的方法,用于快速获取默认的攻击技能。 攻击指令 (Attack) 会自动调用此方法来查找攻击技能。
CreateOrder 仅服务端
csharp
public CmdResult<Order> CreateOrder(Command command)CreateOrder 仅服务端
csharp
public virtual CmdResult<Order> CreateOrder(Command command, Ability? ability)GetValidAttackOrder 仅服务端
csharp
public CmdResult<Order> GetValidAttackOrder(Command command, AbilityExecute? ability = null)为攻击指令创建有效的攻击命令。 该方法是攻击指令系统的核心,负责查找和验证攻击技能,并创建相应的执行命令。
command— 攻击指令,通常Index为Attack。ability— 可选的指定攻击技能。如果为null,则自动查找有效的攻击技能。
返回: 成功时返回包含 OrderAbilityExecute 的结果; 失败时返回相应的错误代码,如 InvalidAbilityType、NoOrderQueue 或 NoValidAttackAbility。
备注
处理逻辑: 如果指定了 ,检查其是否为有效的攻击技能 如果未指定技能,通过 GetValidAttacks 查找所有有效攻击技能 尝试将找到的技能排入指令队列 返回第一个成功入队的攻击命令 错误情况: 指定的技能不是攻击技能或未启用 → InvalidAbilityType 单位没有指令队列组件 → NoOrderQueue 没有找到有效的攻击技能 → NoValidAttackAbility
Dispose 仅服务端
csharp
protected override void Dispose(bool disposing)AbilityManagerExtension 双端
命名空间 GameCore.AbilitySystem.Manager
csharp
public static class AbilityManagerExtension方法
GetComponent 双端
csharp
public static AbilityManager? GetComponent<TComponent>(this Entity entity) where TComponent : AbilityManagerGetOrCreateComponent 双端
csharp
public static AbilityManager GetOrCreateComponent<TComponent>(this Entity entity) where TComponent : AbilityManager