home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Controller.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  3.5 KB  |  135 lines

  1. class Controller
  2. {
  3.    var bPause;
  4.    var oTransition;
  5.    var oMenu;
  6.    var oInstructions;
  7.    var oStartPop;
  8.    var oCheatPop;
  9.    var oTransitionLevel;
  10.    var oSounds;
  11.    static var PACKAGING_INTRO_MUSIC_NAME = "packaging_intro";
  12.    static var PACKAGING_MUSIC_NAME = "packaging_loop";
  13.    static var GAME_MUSIC_NAME = "in_game";
  14.    static var nSFX_VOLUME = 60;
  15.    static var nMUSIC_VOLUME = 60;
  16.    static var oRef = null;
  17.    function Controller(_mcTimeline)
  18.    {
  19.       this.bPause = false;
  20.       Controller.oRef = this;
  21.       this.oTransition = new Transition(_mcTimeline.mcTransition);
  22.       this.oMenu = new Menu(_mcTimeline.mcMenu);
  23.       this.oInstructions = new Instructions(_mcTimeline.mcInstructions);
  24.       this.oStartPop = new StartPopUp(_mcTimeline.mcStartPop);
  25.       this.oCheatPop = new CheatPopUp(_mcTimeline.mcCodePop);
  26.       this.oTransitionLevel = new TransitionLevel(_mcTimeline.mcTransitionLevel);
  27.       this.oSounds = new Sounds(_mcTimeline);
  28.    }
  29.    function pauseGame()
  30.    {
  31.       this.bPause = true;
  32.       CTRLGame.getRef().blockEvents();
  33.       Broadcaster.Instance.doPause();
  34.    }
  35.    function unPauseGame()
  36.    {
  37.       this.bPause = false;
  38.       CTRLGame.getRef().unBlockEvents();
  39.       Broadcaster.Instance.doUnPause();
  40.    }
  41.    function isPaused()
  42.    {
  43.       return this.bPause;
  44.    }
  45.    function isSoundsMuted()
  46.    {
  47.       return this.oSounds.isSoundsMuted();
  48.    }
  49.    function muteSounds()
  50.    {
  51.       this.oSounds.DoMuteSounds();
  52.    }
  53.    function unMuteSounds()
  54.    {
  55.       this.oSounds.UndoMuteSounds();
  56.    }
  57.    function isMusicMuted()
  58.    {
  59.       return this.oSounds.isMusicMuted();
  60.    }
  61.    function muteMusic()
  62.    {
  63.       this.oSounds.DoMuteMusic();
  64.    }
  65.    function unMuteMusic()
  66.    {
  67.       this.oSounds.UndoMuteMusic();
  68.    }
  69.    function goTo(_sGoingTo, _classToMove)
  70.    {
  71.       this.oTransition.goTo(_sGoingTo,_classToMove);
  72.    }
  73.    function goToNewLevel(_nFrameSongs)
  74.    {
  75.       this.oTransitionLevel.goToNewLevel(_nFrameSongs);
  76.    }
  77.    function resetForNewGame()
  78.    {
  79.       this.bPause = false;
  80.    }
  81.    function playRollOverSound()
  82.    {
  83.       this.oSounds.playSound("Button_rollover",Controller.nSFX_VOLUME,1);
  84.    }
  85.    function playClickSound()
  86.    {
  87.       this.oSounds.playSound("Button_click",Controller.nSFX_VOLUME,1);
  88.    }
  89.    function introComplete()
  90.    {
  91.       if(Main.getRef().getSection() == Main.PACKAGING_SECTION)
  92.       {
  93.          this.oSounds.playSound(Controller.PACKAGING_MUSIC_NAME,Controller.nMUSIC_VOLUME,999999);
  94.       }
  95.    }
  96.    function playMusicLoop(_sSectionToPlay)
  97.    {
  98.       if(_sSectionToPlay == Main.PACKAGING_SECTION)
  99.       {
  100.          this.oSounds.startFadeOut(Controller.GAME_MUSIC_NAME);
  101.          this.oSounds.startFadeIn(Controller.PACKAGING_INTRO_MUSIC_NAME,Controller.nMUSIC_VOLUME,1);
  102.       }
  103.       else if(_sSectionToPlay == Main.GAME_SECTION)
  104.       {
  105.          this.oSounds.startFadeOut(Controller.PACKAGING_INTRO_MUSIC_NAME);
  106.          this.oSounds.startFadeOut(Controller.PACKAGING_MUSIC_NAME);
  107.          this.oSounds.startFadeIn(Controller.GAME_MUSIC_NAME,Controller.nMUSIC_VOLUME,999999);
  108.       }
  109.    }
  110.    static function getRef()
  111.    {
  112.       return Controller.oRef;
  113.    }
  114.    function getInstructions()
  115.    {
  116.       return this.oInstructions;
  117.    }
  118.    function getSounds()
  119.    {
  120.       return this.oSounds;
  121.    }
  122.    function getMenu()
  123.    {
  124.       return this.oMenu;
  125.    }
  126.    function getStartPop()
  127.    {
  128.       return this.oStartPop;
  129.    }
  130.    function getCheatPop()
  131.    {
  132.       return this.oCheatPop;
  133.    }
  134. }
  135.