home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / flameout.swf / scripts / __Packages / ApplicationState.as next >
Encoding:
Text File  |  2006-06-13  |  1.4 KB  |  66 lines

  1. class ApplicationState
  2. {
  3.    var m_bMuted;
  4.    var m_eState;
  5.    var AS_APP_STARTED = 0;
  6.    var AS_PRE_GAME = 1;
  7.    var AS_GAME_RUNNING = 2;
  8.    var AS_BETWEEN_ROUNDS = 3;
  9.    var AS_GAME_OVER = 4;
  10.    function ApplicationState()
  11.    {
  12.       this.init();
  13.    }
  14.    function init()
  15.    {
  16.       this.m_bMuted = false;
  17.       this.m_eState = this.AS_APP_STARTED;
  18.    }
  19.    function getState()
  20.    {
  21.       return this.m_eState;
  22.    }
  23.    function setState(eState)
  24.    {
  25.       this.m_eState = eState;
  26.    }
  27.    function isCurrentState(eState)
  28.    {
  29.       return this.m_eState == eState;
  30.    }
  31.    function setPaused(bPaused)
  32.    {
  33.       if(bPaused && !this.isPaused())
  34.       {
  35.          trace("PAUSE");
  36.          LRG.Utils.LRGGameTimer(_global.getGameTimer()).stopClock();
  37.       }
  38.       else if(!bPaused && this.isPaused())
  39.       {
  40.          trace("RESUME");
  41.          LRG.Utils.LRGGameTimer(_global.getGameTimer()).startClock(false);
  42.       }
  43.    }
  44.    function isPaused()
  45.    {
  46.       return !LRG.Utils.LRGGameTimer(_global.getGameTimer()).isRunning();
  47.    }
  48.    function setMuted(bMuted)
  49.    {
  50.       if(this.isMuted() && !bMuted)
  51.       {
  52.          this.m_bMuted = false;
  53.          _global.LRG.LRGMusic.startMusic();
  54.       }
  55.       else if(!this.isMuted() && bMuted)
  56.       {
  57.          _global.LRG.LRGMusic.stopMusic();
  58.          this.m_bMuted = true;
  59.       }
  60.    }
  61.    function isMuted()
  62.    {
  63.       return this.m_bMuted;
  64.    }
  65. }
  66.