Skip to content

Commit

Permalink
Gate teleport: change colors only if not yet activated (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmadlal authored and Dalet committed May 25, 2019
1 parent 6d8c482 commit 2def2d4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 140-speedrun-timer/LevelObject/Cheats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,19 @@ void TeleportToBeatLayerSwitch(int id)
return;
}

if (id >= 0 && id < _beatSwitches.Count)
if (id < 0 || id >= _beatSwitches.Count)
{
TeleportToBeatLayerSwitch(_beatSwitches[id]);
return;
}
// change the colors of the level and player according to the gate
var player = Globals.player.GetComponent<MyCharacterController>();
player.visualPlayer.SetColor((id % 2 == 0) ? Color.black : Color.white, 1f);
CheatColorSphere(id + 1);
var beatSwitch = _beatSwitches[id];
if (beatSwitch.globalBeatLayer > Globals.beatMaster.GetCurrentBeatLayer())
{
// change the colors of the level and player according to the gate
var player = Globals.player.GetComponent<MyCharacterController>();
player.visualPlayer.SetColor((id % 2 == 0) ? Color.black : Color.white, 1f);
CheatColorSphere(id + 1);
}
TeleportToBeatLayerSwitch(beatSwitch);
}

void CheatColorSphere(int beatIndex)
Expand Down

0 comments on commit 2def2d4

Please sign in to comment.