Re-wrote IsInGame function with good code practice
This commit is contained in:
@@ -136,6 +136,7 @@ namespace DevourClient.Hacks
|
||||
public PlayRandomAudioClip burnGoatClips;
|
||||
public PlayRandomAudioClip laughClips;
|
||||
*/
|
||||
|
||||
PlayRandomAudioClip playRandomAudioClip = UnityEngine.Object.FindObjectOfType<PlayRandomAudioClip>();
|
||||
NolanVoiceOvers nolanVoiceOvers = UnityEngine.Object.FindObjectOfType<NolanVoiceOvers>();
|
||||
|
||||
|
||||
@@ -4,20 +4,8 @@
|
||||
{
|
||||
public static bool IsInGame()
|
||||
{
|
||||
//Code pas très beau ici
|
||||
//La variable gameStarted dans la classe Horror.Menu n'existe plus quand on lance une game
|
||||
//Donc si elle existe on retourne sa valeur (qui est false)
|
||||
//Et si elle existe pas (donc si on est ingame) on retourne true
|
||||
|
||||
try
|
||||
{
|
||||
Horror.Menu menu_class = UnityEngine.ScriptableObject.FindObjectOfType<Horror.Menu>();
|
||||
return menu_class.gameStarted;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType<OptionsHelpers>();
|
||||
return optionsHelpers.inGame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ namespace DevourClient
|
||||
if (GUI.Button(new Rect(Settings.Settings.x + 200, Settings.Settings.y + 160, 150, 20), "Random sound"))
|
||||
{
|
||||
Hacks.Misc.PlaySound();
|
||||
MelonLogger.Msg("Playing a random sound !");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user