feat(Signal):实现信号传输的单向连续传播
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user