Passion & UI
This commit is contained in:
@@ -36,6 +36,16 @@ namespace Cielonos.MainGame
|
||||
public bool canTriggerHitEvent = true;
|
||||
public List<string> tags = new List<string>();
|
||||
public Action updateAction;
|
||||
|
||||
/// <summary>
|
||||
/// 当前是否处于反应窗口(含 grace before/after)。无 TimeSubmodule 时回退到 isEnabling。
|
||||
/// </summary>
|
||||
public bool isReactionActive => timeSm?.IsReactionActive() ?? isEnabling;
|
||||
|
||||
/// <summary>
|
||||
/// 在 grace window 期间已成功反应(格挡/闪避)的目标,不再对其造成伤害。
|
||||
/// </summary>
|
||||
[HideInInspector] public HashSet<GameObject> reactedTargets = new HashSet<GameObject>();
|
||||
|
||||
[Title("Submodules")]
|
||||
[HideInEditorMode] public TransformSubmodule transformSm;
|
||||
@@ -60,6 +70,7 @@ namespace Cielonos.MainGame
|
||||
this.targetFractions = targetFractions.ToList();
|
||||
this.canTriggerHitEvent = true;
|
||||
this.tags = new List<string>();
|
||||
this.reactedTargets.Clear();
|
||||
|
||||
attackSm = null;
|
||||
timeSm = null;
|
||||
@@ -159,6 +170,16 @@ namespace Cielonos.MainGame
|
||||
timeSm = new TimeSubmodule(this, lifeTime, delayTime, enableTime, enableAction, timeOutAction);
|
||||
return this as T;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置带反应 grace window 的时间子模块。graceBefore/graceAfter 为 0 时行为与无 grace window 一致。
|
||||
/// </summary>
|
||||
public T SetTimeSubmodule<T>(float lifeTime, float delayTime, float enableTime,
|
||||
Action enableAction, Action timeOutAction, float graceBefore) where T : AttackAreaBase
|
||||
{
|
||||
timeSm = new TimeSubmodule(this, lifeTime, delayTime, enableTime, enableAction, timeOutAction, graceBefore);
|
||||
return this as T;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HitSubmodule
|
||||
@@ -295,7 +316,8 @@ namespace Cielonos.MainGame
|
||||
|
||||
}
|
||||
|
||||
protected virtual void HitOnTarget(Collider hitCollider, Vector3 hitPosition, out Attack.Result attackResult)
|
||||
protected virtual void HitOnTarget(Collider hitCollider, Vector3 hitPosition,
|
||||
out Attack.Result attackResult, bool onlyCheckReaction = false)
|
||||
{
|
||||
CharacterBase target = hitCollider.GetComponentInParent<CharacterBase>();
|
||||
|
||||
@@ -316,6 +338,15 @@ namespace Cielonos.MainGame
|
||||
return;
|
||||
}
|
||||
|
||||
// Grace window 期间仅执行反应检测,不造成伤害和其他效果
|
||||
if (onlyCheckReaction)
|
||||
{
|
||||
attackResult.isBlocked = reactionSm?.CheckBlock(target, creator, hitPosition) ?? false;
|
||||
attackResult.isDodged = reactionSm?.CheckDodge(target) ?? false;
|
||||
attackResult.isReflected = reactionSm?.CheckReflection(target) ?? false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (moveSm is { stopWhenHit: true })
|
||||
{
|
||||
moveSm.canMove = false;
|
||||
|
||||
Reference in New Issue
Block a user