主题
GameCore.TargetingSystem
ITargetingInfo 双端
命名空间 GameCore.TargetingSystem
csharp
public interface ITargetingInfo属性
ActorScope 双端
csharp
public IActorScope ActorScope { get; }Source 双端
csharp
public ITarget Source { get; }Caster 双端
csharp
public Entity? Caster { get; }VectorConeAngle 双端
csharp
public Angle? VectorConeAngle { get; }If the targeting is a cone, the angle of the cone.
CursorRadius 双端
csharp
public float? CursorRadius { get; }If the targeting cursor is an area-of-effect circle, the radius of the circle.
VectorLineWidth 双端
csharp
public float? VectorLineWidth { get; }If the targeting is a line, the width of the line
Range 双端
csharp
public float? Range { get; }The targeting range.
AllowApproachBeyondRange 双端
csharp
public bool AllowApproachBeyondRange { get; }When true, the target will be considered in range even if it is out of the range, the caster will approach the target to the range.
TargetingHighlightFilter 双端
csharp
public TargetFilterComplex? TargetingHighlightFilter { get; }Filter used to determine which targets are highlighted when the targeting indicator is active.
VectorHighlightLimit 双端
csharp
public uint? VectorHighlightLimit { get; }The maximum number of vector line highlights to display. Only works when the targeting indicator has highlight actors set.
RangeScaledVector 双端
命名空间 GameCore.TargetingSystem
csharp
public readonly struct RangeScaledVectorRepresents a 2D vector command target, which can be used in targeting. The actual targeting position is scaled based on the casting range. The X and Y components of the vector are scaling factors. For example, if the X component is 2 and the Y component is 3, the actual target position will be (2 * range, 3 * range).
构造函数
RangeScaledVector 双端
csharp
public RangeScaledVector(float horizontalFactor, float verticalFactor)Represents a 2D vector command target, which can be used in targeting. The actual targeting position is scaled based on the casting range. The X and Y components of the vector are scaling factors. For example, if the X component is 2 and the Y component is 3, the actual target position will be (2 * range, 3 * range).
属性
HorizontalFactor 双端
csharp
public float HorizontalFactor { get; }VerticalFactor 双端
csharp
public float VerticalFactor { get; }Zero 双端
csharp
public static RangeScaledVector Zero { get; }UnitX 双端
csharp
public static RangeScaledVector UnitX { get; }UnitY 双端
csharp
public static RangeScaledVector UnitY { get; }方法
implicit operator 双端
csharp
public static Vector2 implicit operator(RangeScaledVector scaledVector)implicit operator 双端
csharp
public static RangeScaledVector implicit operator(Vector2 vector)Scale 双端
csharp
public Vector2 Scale(float range)Scales the vector by the given range.
range— The range to scale the vector by.
返回: A scaled Vector2.
TargetPosition 双端
csharp
public ScenePoint TargetPosition(ITarget source, float range)Calculates the target position based on the source position, interact radius and the range.
source— The source target.range— The range to scale the vector by.
返回: A ScenePoint representing the target position.
ToAngle 双端
csharp
public Angle ToAngle()Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()ToString 双端
csharp
public override string ToString()operator == 双端
csharp
public static bool operator ==(RangeScaledVector left, RangeScaledVector right)operator != 双端
csharp
public static bool operator !=(RangeScaledVector left, RangeScaledVector right)TargetingIndicator 双端
命名空间 GameCore.TargetingSystem
csharp
public class TargetingIndicator : DisposableObject构造函数
TargetingIndicator 仅客户端
csharp
public TargetingIndicator(ITargetingInfo targetingInfo, IGameLink<GameDataTargetingIndicator> link)Initializes a new instance of the TargetingIndicator class with the specified targeting information and data configuration.
targetingInfo— The targeting information context providing source, range, and other targeting parameters.link— The game data link defining the visual configuration for this targeting indicator.
备注
This constructor sets up all the visual actors and components based on the targeting indicator configuration, including range displays, cursor effects, vector indicators, and highlight systems. The various actor types are created and configured according to the targeting parameters such as range, cursor radius, and line width.
TargetingIndicator 仅服务端
csharp
public TargetingIndicator()属性
DebugDraw 仅客户端
csharp
public IDebugDraw? DebugDraw { get; set; }Gets or sets the debug drawing interface for rendering debugging information.
DebugDrawEnabled 仅客户端
csharp
public bool DebugDrawEnabled { get; set; }Gets or sets a value indicating whether debug drawing is enabled for this targeting indicator.
备注
When enabled, additional visual debugging information such as range circles and geometric shapes will be rendered to help with development and troubleshooting.
RangeActors 仅客户端
csharp
protected HashSet<Actor>? RangeActors { get; set; }Gets or sets the collection of actors used to display ability range indicators.
备注
These actors typically show the maximum range of an ability as circular or other geometric shapes around the caster. They help players understand the effective area of their abilities.
CursorActors 仅客户端
csharp
protected HashSet<Actor>? CursorActors { get; set; }Gets or sets the collection of actors used to display cursor position indicators.
备注
These actors follow the player's cursor or target selection, providing visual feedback about where an ability will be targeted when activated.
VectorConeActors 仅客户端
csharp
protected HashSet<ActorSegmentedSector>? VectorConeActors { get; set; }Gets or sets the collection of segmented actors used to display vector cone targeting indicators.
备注
Vector cone actors are used for abilities that affect targets in a cone-shaped area, such as breath weapons or area-of-effect spells with directional targeting.
VectorLineActors 仅客户端
csharp
protected HashSet<ActorSegmentedRectangle>? VectorLineActors { get; set; }Gets or sets the collection of segmented rectangle actors used to display vector line targeting indicators.
备注
Vector line actors are used for abilities that affect targets in a straight line or rectangular area, such as projectile spells or linear area effects.
HighlightActors 仅客户端
csharp
protected Dictionary<Entity, HashSet<Actor>>? HighlightActors { get; set; }Gets or sets the dictionary mapping entities to their highlight actors for target preview.
备注
This collection manages visual highlights applied to potential targets before the ability is cast, giving players feedback about which entities will be affected by their ability.
PendingHighlightTargets 仅客户端
csharp
protected HashSet<Entity>? PendingHighlightTargets { get; set; }Gets or sets the collection of entities that are pending highlight updates.
备注
This temporary collection tracks entities that need highlight effects added or updated during the next update cycle, helping to manage highlight transitions efficiently.
TargetingInfo 仅客户端
csharp
public ITargetingInfo TargetingInfo { get; }Gets the targeting information context that provides source, range, and other targeting parameters.
Link 仅客户端
csharp
public IGameLink<GameDataTargetingIndicator> Link { get; }Gets the game data link that defines the visual configuration for this targeting indicator.
Cache 仅客户端
csharp
public GameDataTargetingIndicator Cache { get; }Gets the cached targeting indicator data for efficient access to configuration properties.
方法
CreateFromAbility 仅客户端
csharp
public static TargetingIndicator? CreateFromAbility(AbilityExecute abilityExecute)Creates a targeting indicator from an ability execution context.
abilityExecute— The ability execution context containing targeting configuration.
返回: A new targeting indicator instance, or null if the ability doesn't support targeting indicators.
备注
This factory method examines the ability's configuration to determine if it should display targeting indicators and creates an appropriate indicator instance based on the ability's targeting requirements.
UpdateCursorTarget 仅客户端
csharp
public void UpdateCursorTarget(RangeScaledVector vector)Updates the cursor target position using a range-scaled vector for directional targeting.
vector— The range-scaled vector indicating the target direction and distance.
备注
This method is used for abilities that target in a specific direction from the source, calculating the final target position based on the vector and the ability's maximum range.
TargetFilter 仅客户端
csharp
protected bool TargetFilter(Entity entity)Determines whether the specified entity passes the targeting highlight filter.
entity— The entity to test against the filter.
返回: True if the entity should be highlighted; otherwise, false.
备注
This method applies the configured targeting filter to determine if an entity should receive highlight effects. If no filter is configured, all entities are considered valid targets.
FindClosest 仅客户端
csharp
protected IEnumerable<Entity> FindClosest(IEnumerable<Entity> entities, uint amount)Finds the closest entities from a collection, limited to a specified maximum amount.
entities— The collection of entities to search through.amount— The maximum number of entities to return.
返回: An enumerable of the closest entities, up to the specified amount.
备注
This method sorts entities by their distance from the targeting source and returns the closest ones. It's used to limit highlighting effects when there are many potential targets.
UpdateHighlights 仅客户端
csharp
protected void UpdateHighlights()Updates the highlight effects for all pending target entities.
备注
This method manages the addition and removal of highlight actors for entities that are entering or leaving the targeting area. It ensures that highlight effects are properly synchronized with the current set of valid targets.
UpdateCursorTarget 仅客户端
csharp
public void UpdateCursorTarget(ITarget target)Updates the cursor target position and refreshes all targeting indicators to reflect the new target.
target— The new target position or entity to aim towards.
备注
This method updates all visual targeting elements including cursor actors, vector indicators, and target highlights based on the new target position. It also handles range limitations and updates debug drawing if enabled. The method performs entity searches to identify potential targets within the ability's area of effect.
DisposeManaged 双端
csharp
protected override void DisposeManaged()GameDataTargetingIndicator 双端
命名空间 GameCore.TargetingSystem.Data
csharp
public class GameDataTargetingIndicator : GameDataCategory<GameDataTargetingIndicator>, IGameDataCategory<GameDataTargetingIndicator>, IGameData<GameDataTargetingIndicator>, IGameData瞄准指示器配置,定义范围圈、光标、锥形、线条等视觉表现。
构造函数
GameDataTargetingIndicator 双端
csharp
public GameDataTargetingIndicator(GameLink<GameDataTargetingIndicator, GameDataTargetingIndicator> link)GameDataTargetingIndicator 双端
csharp
public GameDataTargetingIndicator(IGameLink<GameDataTargetingIndicator> link)属性
RangeActors 双端
csharp
public List<IGameLink<GameDataActor>?>? RangeActors { get; set; }范围指示用的 Actor 列表,按距离/档位显示不同模型。
CursorActors 双端
csharp
public List<IGameLink<GameDataActor>?>? CursorActors { get; set; }光标/准星指示用的 Actor 列表。
VectorConeActors 双端
csharp
public List<IGameLink<GameDataActorSegmentedSector>?>? VectorConeActors { get; set; }锥形范围指示用的分段 Actor 列表(如扇形技能范围)。 每个 Actor 负责沿扇形两条边生成分段,不负责绘制弧线部分。
VectorLineActors 双端
csharp
public List<IGameLink<GameDataActorSegmentedRectangle>?>? VectorLineActors { get; set; }直线/矩形范围指示用的分段 Actor 列表。
PreTargetingHighlightActors 双端
csharp
public List<IGameLink<GameDataActor>?>? PreTargetingHighlightActors { get; set; }预瞄准时高亮显示的 Actor 列表。
Flags 双端
csharp
public TargetingIndicatorFlags Flags { get; set; }指示器行为标志,如是否显示范围、是否跟随目标等。
TargetingIndicatorFlags 双端
命名空间 GameCore.TargetingSystem.Data.Struct
csharp
public class TargetingIndicatorFlags构造函数
TargetingIndicatorFlags 双端
csharp
public TargetingIndicatorFlags()属性
DebugDraw 双端
csharp
public bool DebugDraw { get; set; }Gets or sets a value indicating whether debug drawing is enabled. When set to true, debug shapes will be drawn in the game scene for debugging purposes. It only works for RangeActors and CursorActors, for VectorConeActors and VectorLineActors, they have their own debug drawing settings.