fix: sync the prototype

This commit is contained in:
Pierre Ryssen
2026-03-30 18:01:33 +02:00
parent 175162fccf
commit fcb0f813dd
19 changed files with 156845 additions and 14766 deletions

View File

@@ -20,7 +20,6 @@ public class PressurePlateButton : MonoBehaviour
public UnityEvent OnReleased;
private readonly HashSet<Collider> m_validCollidersOnPlate = new HashSet<Collider>();
private readonly HashSet<Collider> m_stayedThisPhysicsFrame = new HashSet<Collider>();
private bool m_isPressed;
private void Reset()
@@ -43,16 +42,8 @@ public class PressurePlateButton : MonoBehaviour
}
}
private void OnTriggerStay(Collider other)
{
if (IsValidActivator(other))
m_stayedThisPhysicsFrame.Add(other);
}
private void OnTriggerExit(Collider other)
{
m_stayedThisPhysicsFrame.Remove(other);
if (!m_validCollidersOnPlate.Remove(other))
return;
@@ -63,26 +54,6 @@ public class PressurePlateButton : MonoBehaviour
}
}
private void FixedUpdate()
{
if (m_validCollidersOnPlate.Count == 0)
{
m_stayedThisPhysicsFrame.Clear();
return;
}
m_validCollidersOnPlate.RemoveWhere(c => c == null || !c.enabled || !c.gameObject.activeInHierarchy);
m_validCollidersOnPlate.IntersectWith(m_stayedThisPhysicsFrame);
m_stayedThisPhysicsFrame.Clear();
if (m_validCollidersOnPlate.Count == 0 && m_isPressed)
{
m_isPressed = false;
OnReleased?.Invoke();
}
}
private bool IsValidActivator(Collider other)
{
if (((1 << other.gameObject.layer) & detectionMask) == 0)