Skip to content

Commit 016ccee

Browse files
committed
Made Cave Walls vanish immediately when the player transitions into them
1 parent 004c60a commit 016ccee

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

Entities/CaveWall.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,32 @@ private void OnTransitionOut(float percent) {
163163
}
164164

165165
private void OnTransitionInBegin() {
166-
Level level = SceneAs<Level>();
167-
if (level.PreviousBounds.HasValue && Collide.CheckRect(this, level.PreviousBounds.Value)) {
168-
transitionFade = true;
169-
tiles.Alpha = 0f;
170-
} else {
171-
transitionFade = false;
166+
Level level = SceneAs<Level>();
167+
if (MasterOfGroup) {
168+
Player player = null;
169+
foreach (CaveWall entity in Group) {
170+
if (level.PreviousBounds.HasValue && Collide.CheckRect(entity, level.PreviousBounds.Value)) {
171+
entity.transitionFade = true;
172+
entity.tiles.Alpha = 0f;
173+
} else {
174+
entity.transitionFade = false;
175+
}
176+
player = entity.CollideFirst<Player>();
177+
if (player != null) {
178+
break;
179+
}
180+
}
181+
182+
if (player != null) {
183+
foreach (CaveWall entity in Group) {
184+
entity.transitionFade = false;
185+
entity.tiles.Alpha = 0f;
186+
}
187+
}
172188
}
173189
}
174190

175-
private void OnTransitionIn(float percent) {
191+
private void OnTransitionIn(float percent) {
176192
if (transitionFade) {
177193
tiles.Alpha = percent;
178194
}

0 commit comments

Comments
 (0)