コード例 #1
0
 void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
コード例 #2
0
 void OnEnable()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else if (_instance != this)
     {
         Debug.LogError("Try create another instance to a singleton class!");
     }
 }
コード例 #3
0
ファイル: GameController.cs プロジェクト: PlanchaCorp/ludum44
    /// <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);
    }
コード例 #4
0
 private void Awake()
 {
     _pillManager = GetComponentInParent <PillManager>();
 }