feat(Signal):实现信号传输的单向连续传播

This commit is contained in:
2025-10-28 08:50:06 +08:00
parent 0dd2e3d9d9
commit b06d21114b
7 changed files with 267 additions and 31 deletions

View File

@@ -11,19 +11,27 @@ namespace Script.Gameplay.Facility
[SerializeField] private Vector3 plateOffset = Vector3.up * 0.1f;
private bool lastState = false;
private bool hasObject = false;
private void FixedUpdate()
{
if (!isOpenInEditor) return;
bool hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity, detectLayer);
hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity, detectLayer);
if (hasObject != lastState)
{
SendSignal(hasObject, this.gameObject);
lastState = hasObject;
if (hasObject)
{
// 被压下动画
}
else
{
// 弹起动画
}
}
}
#if UNITY_EDITOR
private void OnDrawGizmosSelected()
{