Exemplo n.º 1
0
    void Awake()
    {
        // Initialization
        timerCounter = GameManager.instance.timerCounter;
        button       = GetComponent <Button>();

        // Get references from GameManager
        timerCounter = GameManager.instance.timerCounter;
        saveGame     = GameManager.instance.saveGame;
        // Get data from saveGame
        currentNumRewards = saveGame.numDailyHeroRewards;

        // If the timer has not been initialized yet (app is opened for the first time)
        // Since timerCounter is a singleton instance under GameManager, when this scene is reloaded later
        // after the app has been opened, the timer will already be initialized and therefore InitTimer() will
        // not be run.
        if (timerCounter.GetTimer(TIMER_KEY) == null)
        {
            InitTimer();
        }
        else
        {
            timerView.timer = timerCounter.GetTimer(TIMER_KEY);
        }
        // Timer has counted down past 0 since last login
        UpdateRewards();
    }