void OnDestroy() { if (_instance == this) { _instance = null; } }
void OnEnable() { if (_instance == null) { _instance = this; } else if (_instance != this) { Debug.LogError("Try create another instance to a singleton class!"); } }
/// <summary> /// Initialize game data /// </summary> private void InitializeGame() { InitGameObjectReferences(); weekNumber = 0; effectsNames = new List <string>(); GameContext.pills.Pills.ForEach(pill => pill.alreadyTaken = false); hospitalHandler.ToggleBlue(true); pillManager = new PillManager(pillImages, fruitImages); playerManager = new PlayerManager(); eventManager = new EventManager(); ChangeStatementIfNeeded(true); }
private void Awake() { _pillManager = GetComponentInParent <PillManager>(); }