예제 #1
0
    private void Awake()
    {
        //singleton initialization
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(instance);
        }

        DontDestroyOnLoad(instance);

        //set null current player on game awaked
        AppController.instance.currentPlayer         = null;
        AppController.instance.allPlayerProgressData = null;

        //save file path
        Debug.Log(Application.persistentDataPath);

        //holding camera values
        cameraHeight = Camera.main.orthographicSize;
        cameraWidth  = cameraHeight * Camera.main.aspect;

        //sets active screen to welcome
        SetState(ApplicationStates.StartMenu);

        //load game data from JSON
        AppController.instance.dataController = new DataController();
        AppController.instance.dataController.LoadGameData();

        //tries to load saved game data if any exists from previous session(s)
        ProgressController.LoadLastSession();
    }