UI 系统
This commit is contained in:
@@ -30,13 +30,17 @@ namespace BaseGames.Enemies.Boss
|
||||
|
||||
private int _count;
|
||||
private bool _inKnockdown;
|
||||
private BaseGames.Core.IGroundedActor _playerGround;
|
||||
private Transform _cachedPlayer;
|
||||
|
||||
/// <summary>
|
||||
/// 由 <see cref="ChaoFengBoss.OnDamageTaken"/> 调用,累计受击并在达到阈值时触发击落。
|
||||
/// 仅统计「玩家处于空中」时的命中(设计:空中攻击命中嘲风才计入击落)。
|
||||
/// </summary>
|
||||
public void OnBossHit(DamageInfo info)
|
||||
{
|
||||
if (_inKnockdown || _boss == null || _boss.CurrentPhase != 1) return;
|
||||
if (!IsPlayerAirborne()) return; // Q6:仅玩家在空中的命中计数
|
||||
|
||||
_count++;
|
||||
if (_count >= _threshold)
|
||||
@@ -46,6 +50,23 @@ namespace BaseGames.Enemies.Boss
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过 Boss 缓存的 PlayerTransform 取玩家的 <see cref="BaseGames.Core.IGroundedActor"/>(PlayerMovement 实现),
|
||||
/// 判定其是否离地。取不到接口时按「空中」处理(保守计数,避免机制失效)。
|
||||
/// </summary>
|
||||
private bool IsPlayerAirborne()
|
||||
{
|
||||
var player = _boss.PlayerTransform;
|
||||
if (player == null) return false;
|
||||
if (!ReferenceEquals(player, _cachedPlayer))
|
||||
{
|
||||
_cachedPlayer = player;
|
||||
_playerGround = player.GetComponentInParent<BaseGames.Core.IGroundedActor>()
|
||||
?? player.GetComponentInChildren<BaseGames.Core.IGroundedActor>();
|
||||
}
|
||||
return _playerGround == null || !_playerGround.IsGrounded;
|
||||
}
|
||||
|
||||
/// <summary>强制结束正在进行中的击落序列(由 ChaoFengBoss.DefeatSequence 调用)。</summary>
|
||||
public void ForceEnd()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user