引雷标记extender
This commit is contained in:
@@ -36,6 +36,7 @@ namespace Cielonos.MainGame
|
||||
public bool canTriggerHitEvent = true;
|
||||
public List<string> tags = new List<string>();
|
||||
public Action updateAction;
|
||||
private Predicate<CharacterBase> _targetFilter;
|
||||
[NonSerialized, HideInEditorMode] public CreatorTimePolicy timePolicy;
|
||||
|
||||
/// <summary>
|
||||
@@ -93,6 +94,7 @@ namespace Cielonos.MainGame
|
||||
this.targetFractions = targetFractions.ToList();
|
||||
this.canTriggerHitEvent = true;
|
||||
this.tags = new List<string>();
|
||||
this._targetFilter = null;
|
||||
this.timePolicy = DefaultTimePolicy;
|
||||
this.reactedTargets.Clear();
|
||||
|
||||
@@ -411,14 +413,25 @@ namespace Cielonos.MainGame
|
||||
public partial class AttackAreaBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查目标角色是否为有效攻击目标:非创建者自身,且属于目标阵营。
|
||||
/// 设置只对当前池化实例有效的额外目标条件。
|
||||
/// </summary>
|
||||
public T SetTargetFilter<T>(Predicate<CharacterBase> targetFilter) where T : AttackAreaBase
|
||||
{
|
||||
// 对池化 AttackArea 施加本次运行时目标约束;Initialize 会负责清空。
|
||||
_targetFilter = targetFilter;
|
||||
return this as T;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查目标角色是否为有效攻击目标:非创建者自身,且属于目标阵营并满足额外目标条件。
|
||||
/// </summary>
|
||||
public bool IsValidTarget(CharacterBase target)
|
||||
{
|
||||
if (target == null || target == creator) return false;
|
||||
if (!target.gameObject.activeInHierarchy) return false;
|
||||
if (target.statusSm == null || target.statusSm.isDead) return false;
|
||||
return targetFractions.Contains(target.fraction);
|
||||
if (!targetFractions.Contains(target.fraction)) return false;
|
||||
return _targetFilter?.Invoke(target) ?? true;
|
||||
}
|
||||
|
||||
public virtual void HitCharacter(Collider characterCollider, Vector3 hitPosition)
|
||||
|
||||
Reference in New Issue
Block a user