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 burnGoatClips;
|
||||||
public PlayRandomAudioClip laughClips;
|
public PlayRandomAudioClip laughClips;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PlayRandomAudioClip playRandomAudioClip = UnityEngine.Object.FindObjectOfType<PlayRandomAudioClip>();
|
PlayRandomAudioClip playRandomAudioClip = UnityEngine.Object.FindObjectOfType<PlayRandomAudioClip>();
|
||||||
NolanVoiceOvers nolanVoiceOvers = UnityEngine.Object.FindObjectOfType<NolanVoiceOvers>();
|
NolanVoiceOvers nolanVoiceOvers = UnityEngine.Object.FindObjectOfType<NolanVoiceOvers>();
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,8 @@
|
|||||||
{
|
{
|
||||||
public static bool IsInGame()
|
public static bool IsInGame()
|
||||||
{
|
{
|
||||||
//Code pas très beau ici
|
OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType<OptionsHelpers>();
|
||||||
//La variable gameStarted dans la classe Horror.Menu n'existe plus quand on lance une game
|
return optionsHelpers.inGame;
|
||||||
//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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ namespace DevourClient
|
|||||||
if (GUI.Button(new Rect(Settings.Settings.x + 200, Settings.Settings.y + 160, 150, 20), "Random sound"))
|
if (GUI.Button(new Rect(Settings.Settings.x + 200, Settings.Settings.y + 160, 150, 20), "Random sound"))
|
||||||
{
|
{
|
||||||
Hacks.Misc.PlaySound();
|
Hacks.Misc.PlaySound();
|
||||||
|
MelonLogger.Msg("Playing a random sound !");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user