forked from cgvr/DeltaVR
radio button is disabled before radio is grabbed
This commit is contained in:
@@ -12,6 +12,7 @@ public class ReleasableButton : MonoBehaviour
|
||||
public float moveDuration = 0.25f;
|
||||
public float moveAmount = 0.05f;
|
||||
|
||||
private bool isLocked;
|
||||
private float upPositionY;
|
||||
private float downPositionY;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class ReleasableButton : MonoBehaviour
|
||||
private void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
// if button is up, start moving down
|
||||
if (buttonState == 0 && collider.gameObject.tag.EndsWith("Hand"))
|
||||
if (buttonState == 0 &&!isLocked && collider.gameObject.tag.EndsWith("Hand"))
|
||||
{
|
||||
Activate();
|
||||
OnButtonPressed?.Invoke();
|
||||
@@ -53,7 +54,7 @@ public class ReleasableButton : MonoBehaviour
|
||||
private void OnTriggerExit(Collider collider)
|
||||
{
|
||||
// if button is down, start moving up
|
||||
if (buttonState == 1 && collider.gameObject.tag.EndsWith("Hand"))
|
||||
if (buttonState == 1 && !isLocked && collider.gameObject.tag.EndsWith("Hand"))
|
||||
{
|
||||
Deactivate();
|
||||
OnButtonReleased?.Invoke();
|
||||
@@ -81,4 +82,14 @@ public class ReleasableButton : MonoBehaviour
|
||||
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, gameObject);
|
||||
}
|
||||
|
||||
public void Lock()
|
||||
{
|
||||
isLocked = true;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
isLocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user