small bug in elevator

This commit is contained in:
2023-05-16 08:14:34 +02:00
parent c9d1717acc
commit b9bfeda9b6
4 changed files with 32 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ namespace Station46.Modules.Elevated_Platform.Scripts
AscendHash = Animator.StringToHash("Ascend"),
DescendHash = Animator.StringToHash("Descend");
[BoxGroup("Internal")] [SerializeField] private Button _button;
[BoxGroup("Internal")] [SerializeField] private HoloButton button;
[ShowNativeProperty]
internal Status ElevatorStatus
@@ -34,14 +34,21 @@ namespace Station46.Modules.Elevated_Platform.Scripts
case Status.Bottom:
case Status.Top:
ReleasePlayer();
if (!_leftElevatorWhileMoving)
if (_leftElevatorWhileMoving)
{
_button.Enable();
button.hideWhenDisabled = true;
button.Enable();
button.Disable();
}
else
{
button.Enable();
}
_leftElevatorWhileMoving = false;
break;
case Status.Moving:
_button.Disable();
button.hideWhenDisabled = false;
button.Disable();
CapturePlayer();
break;
default:
@@ -62,7 +69,7 @@ namespace Station46.Modules.Elevated_Platform.Scripts
private void Start()
{
_button.ButtonEvent += (_, type) =>
button.ButtonEvent += (_, type) =>
{
if (type == ButtonEventType.Pressed)
{
@@ -112,9 +119,16 @@ namespace Station46.Modules.Elevated_Platform.Scripts
private void OnTriggerEnter(Collider other)
{
if (_status != Status.Moving && other.CompareTag("MainCamera"))
if (other.CompareTag("MainCamera"))
{
_button.Enable();
if (_status == Status.Moving)
{
_leftElevatorWhileMoving = false;
}
else
{
button.Enable();
}
}
}
@@ -128,7 +142,8 @@ namespace Station46.Modules.Elevated_Platform.Scripts
}
else
{
_button.Disable();
button.hideWhenDisabled = true;
button.Disable();
}
}
}