Skip to content

Commit

Permalink
Fixed so disabling Level Failed Effect doesn't also disable the fail …
Browse files Browse the repository at this point in the history
…counter text.
  • Loading branch information
Zingabopp committed Mar 3, 2019
1 parent 2be04e8 commit 423f9c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
21 changes: 13 additions & 8 deletions BailOutMode/BailOutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,20 @@ public void ShowLevelFailed()
Logger.Trace("BailOutController ShowLevelFailed()");
BS_Utils.Gameplay.ScoreSubmission.DisableSubmission(Plugin.PluginName);
FailText.text = $"Bailed Out {Plugin._numFails} time{(Plugin._numFails != 1 ? "s" : "")}";
if (!isHiding)
if (!isHiding && Plugin.ShowFailEffect)
{
LevelFailedEffect.gameObject.SetActive(true);
LevelFailedEffect.ShowEffect();
if (Plugin.FailEffectDuration > 0)
StartCoroutine(hideLevelFailed());
else
isHiding = true; // Fail text never hides, so don't try to keep showing it

try
{
LevelFailedEffect.gameObject.SetActive(true);
LevelFailedEffect.ShowEffect();
if (Plugin.FailEffectDuration > 0)
StartCoroutine(hideLevelFailed());
else
isHiding = true; // Fail text never hides, so don't try to keep showing it
} catch (Exception ex)
{
Logger.Exception("Exception trying to show the fail Effect", ex);
}
}
}

Expand Down
15 changes: 2 additions & 13 deletions BailOutMode/Harmony_Patches/GameEnergyCounterAddEnergy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,12 @@ static bool Prefix(GameEnergyCounter __instance, ref float value)
Logger.Debug($"{__instance.energy} + {value} puts us <= 0");
value = (Plugin.EnergyResetAmount / 100f) - __instance.energy;
Logger.Debug("Changing value to {0} to raise energy to {1}", value, Plugin.EnergyResetAmount);
if (Plugin.ShowFailEffect)
{
try
{
Logger.Debug("Trying to show LevelFailedEffect");
BailOutController.Instance.ShowLevelFailed();
}
catch (Exception ex)
{
Logger.Exception("Exception trying to show the fail Effect", ex);
}
}
BailOutController.Instance.ShowLevelFailed();
}
}
return true;
}
}


}

0 comments on commit 423f9c9

Please sign in to comment.