Skip to content

Commit 3595323

Browse files
authored
fix: handle interrupted camera transitions (#80)
1 parent e3f1144 commit 3595323

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Assets/View/Office/States/MenuState.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ private void Start() {
2020
}
2121

2222
protected virtual void Update() {
23-
if (_brain.ActiveBlend == null) {
24-
return;
25-
}
26-
27-
float progress;
28-
if (_brain.ActiveBlend.CamA == Camera) {
29-
progress = 1 - _brain.ActiveBlend.BlendWeight;
30-
} else if (_brain.ActiveBlend.CamB == Camera) {
31-
progress = _brain.ActiveBlend.BlendWeight;
32-
} else {
33-
progress = IsActive ? 1 : 0;
23+
float progress = IsActive ? 1 : 0;
24+
25+
if (_brain.ActiveBlend != null) {
26+
if (_brain.ActiveBlend.CamA == Camera) {
27+
progress = 1 - _brain.ActiveBlend.BlendWeight;
28+
} else if (_brain.ActiveBlend.CamB == Camera) {
29+
progress = _brain.ActiveBlend.BlendWeight;
30+
}
3431
}
3532

3633
if (_progress.HasChanged(progress)) {

0 commit comments

Comments
 (0)