Files
zeling_v2/Assets/Scripts/Parry/ParrySystem.cs
2026-05-08 11:04:00 +08:00

31 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
namespace BaseGames.Parry
{
/// <summary>
/// 弹反状态管理器。Phase 1 桩 — Phase 2 实现。
/// 只负责维护「当前是否处于弹反窗口」,不感知任何伤害数据类型。
/// HurtBoxCombat 层)主动调用 ConsumeParry() 来查询并消费弹反机会。
/// </summary>
public class ParrySystem : MonoBehaviour
{
/// <summary>当前是否处于弹反激活窗口。Phase 2 由输入/动画事件写入。</summary>
public bool IsParrying { get; private set; }
/// <summary>
/// 查询并消费一次弹反机会。
/// 若处于弹反窗口则返回 true 并关闭窗口;否则返回 false。
/// </summary>
public bool ConsumeParry()
{
if (!IsParrying) return false;
IsParrying = false;
return true;
}
// Phase 2由动画事件 / InputReader 调用以开启弹反窗口
public void OpenParryWindow() => IsParrying = true;
public void CloseParryWindow() => IsParrying = false;
}
}