Re-wrote IsInGame function with good code practice
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user