home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 150 / MOBICLIC150.ISO / pc / DATA / DSS150 / DSS150_02 / DSS150_02.swf / scripts / dss150_02 / ATTENTE.as next >
Text File  |  2012-12-19  |  27KB  |  739 lines

  1. package dss150_02
  2. {
  3.    import com.milanpresse.engineaddons.facades.GameEngine;
  4.    import com.milanpresse.engineaddons.gamesprotos.Actor;
  5.    import com.milanpresse.engineaddons.gamesprotos.actors.actorClip.*;
  6.    import com.milanpresse.engineaddons.timers.TimerChild;
  7.    import flash.display.MovieClip;
  8.    import flash.ui.Mouse;
  9.    
  10.    public class ATTENTE
  11.    {
  12.        
  13.       
  14.       private var game:GameEngine;
  15.       
  16.       public var onEvent:Function = null;
  17.       
  18.       private var _container:IActorClip;
  19.       
  20.       private var mainTimeline:IActorClip;
  21.       
  22.       private var attente:Actor;
  23.       
  24.       private var timerIgloo:ActorTimer;
  25.       
  26.       private var timerOiseauAll:ActorTimer;
  27.       
  28.       private var timerOiseau:ActorTimer;
  29.       
  30.       private var timerPhoqueAll:ActorTimer;
  31.       
  32.       private var timerPhoque:ActorTimer;
  33.       
  34.       private var timerPiege:ActorTimer;
  35.       
  36.       private var timerRelance:ActorTimer;
  37.       
  38.       private var phoqueAll:IActorClip;
  39.       
  40.       private var phoque:IActorClip;
  41.       
  42.       private var oiseaux:Vector.<IActorClip>;
  43.       
  44.       protected var oiseauxDisponibles:Vector.<IActorClip>;
  45.       
  46.       private var iglooJeu:IActorClip;
  47.       
  48.       private var akiak:IActorClip;
  49.       
  50.       private var piste02:IActorClip;
  51.       
  52.       private var piege:IActorClip;
  53.       
  54.       private var neige:IActorClip;
  55.       
  56.       protected var level:int = 0;
  57.       
  58.       protected var timerCurseur:TimerChild;
  59.       
  60.       private var curseur:IActorClip;
  61.       
  62.       private var _mouseVisible:Boolean = true;
  63.       
  64.       protected var timerLevel:TimerChild;
  65.       
  66.       protected var timerPiegeOuvert:TimerChild = null;
  67.       
  68.       protected var timerPhoqueMove:TimerChild = null;
  69.       
  70.       protected var numOiseauxAvantEchec:int = 5;
  71.       
  72.       protected var oiseauxMaxNum:int = 2;
  73.       
  74.       protected var gameFinished:Boolean = false;
  75.       
  76.       protected var enemiesLaunched:Vector.<IActorClip>;
  77.       
  78.       protected var keyDetecter:KeyDetecter;
  79.       
  80.       protected var waitKeyDown:Boolean = false;
  81.       
  82.       protected var isSleeping:Boolean = false;
  83.       
  84.       protected var sleepState:Object;
  85.       
  86.       public function ATTENTE(game:GameEngine, container:IActorClip, mainTimeline:IActorClip)
  87.       {
  88.          this.oiseaux = new Vector.<IActorClip>();
  89.          this.oiseauxDisponibles = new Vector.<IActorClip>();
  90.          this.enemiesLaunched = new Vector.<IActorClip>();
  91.          this.sleepState = {"mouseVisible":true};
  92.          super();
  93.          this.game = game;
  94.          this._container = container;
  95.          this.mainTimeline = mainTimeline;
  96.          this.init();
  97.          this.start();
  98.       }
  99.       
  100.       public function loopDebugLaunch() : void
  101.       {
  102.          this.game.mainTimer.addFromObj({
  103.             "id":"loopDebug",
  104.             "delay":100,
  105.             "onDelay":function(tc:TimerChild):void
  106.             {
  107.             }
  108.          });
  109.       }
  110.       
  111.       public function init() : void
  112.       {
  113.          this.attente = this.game.addActor(new Actor(this.game));
  114.          this.attente.name = "ATTENTE";
  115.          this.keyDetecter = this.attente.addActor({
  116.             "type":KeyDetecter,
  117.             "stage":this.game.stage
  118.          }) as KeyDetecter;
  119.          this.waitKeyDown = false;
  120.          this.level = 0;
  121.          this.oiseauxDisponibles.length = 0;
  122.          this.oiseaux.length = 0;
  123.          this.numOiseauxAvantEchec = 5;
  124.          this.gameFinished = false;
  125.          this.enemiesLaunched.length = 0;
  126.          this.neigeInit();
  127.          this.phoqueInit();
  128.          this.piegeInit();
  129.          this.iglooInit();
  130.          this.oiseauxInit();
  131.          this.piste02Init();
  132.          this.curseurInit();
  133.       }
  134.       
  135.       public function start() : void
  136.       {
  137.          this.mouseVisible = false;
  138.          this.game.mainTimer.start();
  139.          this.iglooLaunch();
  140.          this.loopDebugLaunch();
  141.          this.levelStart();
  142.       }
  143.       
  144.       public function restart() : void
  145.       {
  146.          for(var i:int = 0; i < this.oiseaux.length; i++)
  147.          {
  148.             this.oiseaux[i]["oiseau"].clip.OISEAU_IN.scaleX = this.oiseaux[i]["scaleXOri"];
  149.          }
  150.          this.destroy();
  151.          this.init();
  152.          this.start();
  153.       }
  154.       
  155.       public function levelStart() : void
  156.       {
  157.          trace("levelStart");
  158.          ++this.level;
  159.          if(this.level > 5)
  160.          {
  161.             this.level = 5;
  162.          }
  163.          trace(">> LEVEL START",this.level);
  164.          this.timerLevel = this.game.mainTimer.addFromObj({
  165.             "id":"timerLevel",
  166.             "delay":this.game.moduleConfig.levels[this.level - 1].duration,
  167.             "loop":1,
  168.             "onDelay":function(tc:TimerChild):void
  169.             {
  170.                timerLevel["finished"] = true;
  171.                trace(">> LEVEL FINISHED",level);
  172.             }
  173.          });
  174.          this.timerLevel["finished"] = false;
  175.          trace("levelContinue from levelStart");
  176.          this.levelContinue();
  177.       }
  178.       
  179.       public function levelContinue() : void
  180.       {
  181.          var _loc1_:int = 0;
  182.          var _loc2_:int = 0;
  183.          trace("levelContinue",this.level,"ox:",this.getNumEnemiesLaunched("oiseau"),"ph:",this.getNumEnemiesLaunched("phoque"));
  184.          if(this.timerLevel == null || this.timerLevel["finished"] == false)
  185.          {
  186.             _loc1_ = this.game.moduleConfig.levels[this.level - 1].oiseauxMaxNum - this.getNumEnemiesLaunched("oiseau");
  187.             for(_loc2_ = 0; _loc2_ < _loc1_; _loc2_++)
  188.             {
  189.                this.oiseauLaunch();
  190.             }
  191.             _loc1_ = this.game.moduleConfig.levels[this.level - 1].phoquesMaxNum - this.getNumEnemiesLaunched("phoque");
  192.             for(_loc2_ = 0; _loc2_ < _loc1_; _loc2_++)
  193.             {
  194.                this.phoqueLaunch();
  195.             }
  196.          }
  197.          else if(this.getNumEnemiesLaunched() == 0)
  198.          {
  199.             this.levelStart();
  200.          }
  201.       }
  202.       
  203.       public function succes() : void
  204.       {
  205.          trace("succes");
  206.          this.mouseVisible = true;
  207.          this.game.mainTimer.stop();
  208.          this.gameFinished = true;
  209.          this.game.noiseStop();
  210.          this.game.commentStop();
  211.          this.game.memo.module.succes = true;
  212.          this.game.memo.save();
  213.          this.game.noisePlay({
  214.             "code":"B_VALIDE",
  215.             "callback":function():void
  216.             {
  217.                finish();
  218.             }
  219.          });
  220.       }
  221.       
  222.       private function finish() : void
  223.       {
  224.          trace("finish");
  225.          this.destroy();
  226.          if(this.onEvent != null)
  227.          {
  228.             this.onEvent({"action":"succes"});
  229.          }
  230.       }
  231.       
  232.       public function curseurInit() : void
  233.       {
  234.          this.curseur = this.attente.addActor({"mc":this._container.getChildByName("CURSEUR") as MovieClip});
  235.          this.curseur.enabled = false;
  236.          this.curseur.clip.cacheAsBitmap = true;
  237.          this.curseur["timerCurseur"] = this.game.mainTimer.addFromObj({
  238.             "id":"timerCurseur",
  239.             "delay":10,
  240.             "onDelay":function(tc:TimerChild):void
  241.             {
  242.                curseur.setToPos(game.stage.mouseX,game.stage.mouseY);
  243.             }
  244.          });
  245.          this.mouseVisible = false;
  246.       }
  247.       
  248.       public function iglooInit() : void
  249.       {
  250.          this.iglooJeu = this.attente.addActor({"mc":this._container.getChildByName("IGLOO_JEU") as MovieClip});
  251.          this.iglooJeu["pourcent"] = 0;
  252.          this.iglooJeu["frameActual"] = 1;
  253.          this.akiak = this.attente.addActor({"mc":this._container.getChildByName("IGLOO_JEU.AKIAK") as MovieClip});
  254.       }
  255.       
  256.       public function iglooLaunch() : void
  257.       {
  258.          this.iglooJeu["timerIgloo"] = this.game.mainTimer.addFromObj({
  259.             "id":"timerIgloo",
  260.             "delay":this.game.moduleConfig["iglooSpeed"],
  261.             "onDelay":function(tc:TimerChild):void
  262.             {
  263.                ++iglooJeu["frameActual"];
  264.                iglooJeu.gotoAndStop(iglooJeu["frameActual"]);
  265.                if(iglooJeu["frameActual"] == iglooJeu.totalFrames)
  266.                {
  267.                   succes();
  268.                   return;
  269.                }
  270.                if(iglooJeu["frameActual"] == 11)
  271.                {
  272.                   game.commentPlay({
  273.                      "code":"18_JEU_INFO_01",
  274.                      "zapBlock":"NOZAP_NOBLOCK"
  275.                   });
  276.                }
  277.                else if(iglooJeu["frameActual"] == 28)
  278.                {
  279.                }
  280.             }
  281.          });
  282.       }
  283.       
  284.       public function neigeInit() : void
  285.       {
  286.          this.neige = this.attente.addActor({"mc":this._container.getChildByName("NEIGE") as MovieClip});
  287.          this.neige.gotoAndStop(1);
  288.          this.neige.visible = false;
  289.       }
  290.       
  291.       public function oiseauxInit() : void
  292.       {
  293.          var oiseauAll:IActorClip = null;
  294.          var oiseau:IActorClip = null;
  295.          for(var i:int = 1; i <= 2; i++)
  296.          {
  297.             oiseauAll = this.attente.addActor({"mc":this._container.getChildByName("OISEAU_0" + i) as MovieClip});
  298.             oiseau = oiseauAll["oiseau"] = oiseauAll.addActor({
  299.                "mc":this._container.getChildByName("OISEAU_0" + i + ".OISEAU") as MovieClip,
  300.                "onRollOverState":{"label":undefined},
  301.                "onRollOutState":{"label":undefined},
  302.                "onRollClickState":{"label":undefined}
  303.             });
  304.             oiseau["oiseauAll"] = oiseauAll;
  305.             oiseau.initAs();
  306.             oiseau["no"] = i;
  307.             oiseauAll["typeEnemy"] = "oiseau";
  308.             oiseauAll["sens"] = 1;
  309.             oiseauAll["launched"] = false;
  310.             oiseauAll["scaleXOri"] = oiseau.clip.OISEAU_IN.scaleX;
  311.             oiseau.onClick = function(actor:IActorClip):void
  312.             {
  313.                trace(this,"click");
  314.                actor.enabled = false;
  315.                actor["oiseauAll"]["alreadyHit"] = true;
  316.                actor["oiseauAll"]["timerOiseauMove"].stop();
  317.                actor.gotoAndStop("E2");
  318.                game.noisePlay({
  319.                   "code":"B_TIR",
  320.                   "callback":function():void
  321.                   {
  322.                      if(gameFinished == false)
  323.                      {
  324.                         actor.gotoAndStop("E1");
  325.                         actor["oiseauAll"]["sens"] = -1;
  326.                         actor.clip.OISEAU_IN.scaleX = actor["oiseauAll"]["scaleXOri"] * actor["oiseauAll"]["sens"];
  327.                         actor["oiseauAll"]["timerOiseauMove"].start();
  328.                      }
  329.                   }
  330.                });
  331.             };
  332.             oiseau.enabled = true;
  333.             oiseau.gotoAndStop("E1");
  334.             oiseauAll.gotoAndStop(1);
  335.             this.oiseaux.push(oiseauAll);
  336.          }
  337.          var lasttimeOiseau:Number = 0;
  338.       }
  339.       
  340.       public function oiseauLaunch() : void
  341.       {
  342.          var oiseauActuel:IActorClip = null;
  343.          trace("oiseauLaunch");
  344.          this.oiseauxDisponibles = this.oiseaux.filter(function(item:*, index:int, array:Vector.<IActorClip>):Boolean
  345.          {
  346.             return item["launched"] == false;
  347.          },this);
  348.          oiseauActuel = this.oiseauxDisponibles[Math.floor(Math.random() * this.oiseauxDisponibles.length)];
  349.          oiseauActuel.gotoAndStop(1);
  350.          oiseauActuel["sens"] = 1;
  351.          oiseauActuel["oiseau"].clip.OISEAU_IN.scaleX = oiseauActuel["scaleXOri"];
  352.          oiseauActuel["oiseau"].gotoAndStop("E1");
  353.          oiseauActuel["oiseau"].enabled = true;
  354.          oiseauActuel["alreadyHit"] = false;
  355.          oiseauActuel["launched"] = true;
  356.          this.curseur.dragDrop.dropTargets = [oiseauActuel["oiseau"]];
  357.          this.enemiesLaunchedAdd(oiseauActuel);
  358.          this.game.mainTimer.addFromObj({
  359.             "delay":Math.floor(Math.random() * 3000),
  360.             "loop":1,
  361.             "onDelay":function(tc:TimerChild):void
  362.             {
  363.                trace("oiseauLaunch time");
  364.                if(gameFinished)
  365.                {
  366.                   return;
  367.                }
  368.                oiseauActuel["timerOiseauMove"] = game.mainTimer.addFromObj({
  369.                   "id":"timerOiseauMove" + oiseauActuel["oiseau"]["no"],
  370.                   "delay":game.moduleConfig.levels[level - 1].oiseauxSpeed,
  371.                   "onDelay":function(tc:TimerChild):void
  372.                   {
  373.                      trace("oiseauMove time");
  374.                      if(gameFinished)
  375.                      {
  376.                         return;
  377.                      }
  378.                      if(oiseauActuel.currentLabel == "HIT" && oiseauActuel["alreadyHit"] == false)
  379.                      {
  380.                         trace("HIT");
  381.                         --numOiseauxAvantEchec;
  382.                         oiseauActuel["alreadyHit"] = true;
  383.                         oiseauActuel["oiseau"].enabled = false;
  384.                         tc.stop();
  385.                         iglooJeu["timerIgloo"].reset();
  386.                         iglooJeu["frameActual"] = iglooJeu["frameActual"] <= 1 ? 1 : iglooJeu["frameActual"] - 1;
  387.                         iglooJeu.gotoAndStop(iglooJeu["frameActual"]);
  388.                         oiseauActuel["oiseau"].gotoAndStop("E3");
  389.                         game.noisePlay({
  390.                            "code":"B_PERD",
  391.                            "callback":function():void
  392.                            {
  393.                               oiseauActuel["oiseau"].gotoAndStop("E1");
  394.                               oiseauActuel["alreadyHit"] = true;
  395.                               tc.start();
  396.                               iglooJeu["timerIgloo"].start();
  397.                            }
  398.                         });
  399.                         if(numOiseauxAvantEchec <= 0)
  400.                         {
  401.                            game.mainTimer.stop();
  402.                            gameFinished = true;
  403.                            game.commentStop();
  404.                            oiseauNoiseVolClean();
  405.                            akiak.gotoAndStop("E2");
  406.                            mouseVisible = true;
  407.                            keyDetecter.enabled = false;
  408.                            game.noisePlay({
  409.                               "code":"B_COLERE",
  410.                               "callback":function():void
  411.                               {
  412.                                  akiak.gotoAndStop("E1");
  413.                                  piste02.onLabelEnter = function(result:*):void
  414.                                  {
  415.                                     if(piste02.currentLabel == "FIN")
  416.                                     {
  417.                                        piste02.visible = false;
  418.                                        piste02.stop();
  419.                                        _container.visible = false;
  420.                                        mainTimeline.gotoAndStop("_18_JEU_E1",{"labelLastCallback":function():void
  421.                                        {
  422.                                           mainTimeline.visible = false;
  423.                                           _container.visible = true;
  424.                                           restart();
  425.                                        }});
  426.                                        mainTimeline.visible = true;
  427.                                     }
  428.                                  };
  429.                                  piste02.play(1);
  430.                               }
  431.                            });
  432.                         }
  433.                         return;
  434.                      }
  435.                      if(oiseauActuel["sens"] == 1 && oiseauActuel.currentFrame < oiseauActuel.totalFrames || oiseauActuel["sens"] == -1 && oiseauActuel.currentFrame > 1)
  436.                      {
  437.                         oiseauActuel["frameActual"] = oiseauActuel.currentFrame + oiseauActuel["sens"] * 4;
  438.                         if(oiseauActuel["frameActual"] < 1)
  439.                         {
  440.                            oiseauActuel["frameActual"] = 1;
  441.                         }
  442.                         else if(oiseauActuel["frameActual"] > oiseauActuel.totalFrames)
  443.                         {
  444.                            oiseauActuel["frameActual"] = oiseauActuel.totalFrames;
  445.                         }
  446.                         oiseauActuel.gotoAndStop(oiseauActuel["frameActual"]);
  447.                      }
  448.                      else
  449.                      {
  450.                         trace("fini");
  451.                         tc.stop();
  452.                         enemiesLaunchedRemove(oiseauActuel);
  453.                         oiseauActuel["launched"] = false;
  454.                         trace("levelContinue from piaf");
  455.                         levelContinue();
  456.                      }
  457.                   }
  458.                });
  459.             }
  460.          });
  461.       }
  462.       
  463.       public function oiseauNoiseVolClean() : void
  464.       {
  465.       }
  466.       
  467.       public function phoqueInit() : void
  468.       {
  469.          this.phoqueAll = this.attente.addActor({"mc":this._container.getChildByName("PHOQUE") as MovieClip});
  470.          this.phoqueAll["typeEnemy"] = "phoque";
  471.          this.phoqueAll["launched"] = "false";
  472.          this.phoqueAll["JEU_NIV4_JOUE"] = false;
  473.          this.phoque = this.attente.addActor({"mc":this._container.getChildByName("PHOQUE.PHOQUE") as MovieClip});
  474.       }
  475.       
  476.       public function phoqueLaunch() : void
  477.       {
  478.          trace("phoqueLaunch");
  479.          this.enemiesLaunchedAdd(this.phoqueAll);
  480.          this.game.mainTimer.addFromObj({
  481.             "id":"phoqueLaunch",
  482.             "delay":Math.floor(Math.random() * 3000),
  483.             "loop":1,
  484.             "onDelay":function(tci:TimerChild):void
  485.             {
  486.                trace("phoqueLaunchInTimer");
  487.                phoqueAll.gotoAndStop(1);
  488.                phoque.gotoAndStop("E1");
  489.                piege.enabled = true;
  490.                keyDetecter.enabled = true;
  491.                if(phoqueAll["JEU_NIV4_JOUE"] == false)
  492.                {
  493.                   phoqueAll["JEU_NIV4_JOUE"] = true;
  494.                   piege.gotoAndStop("E4");
  495.                   game.commentPlay({
  496.                      "code":"18_JEU_NIV4",
  497.                      "zapBlock":"NOZAP_NOBLOCK",
  498.                      "callback":function():void
  499.                      {
  500.                         piege.gotoAndStop("E1");
  501.                      }
  502.                   });
  503.                }
  504.                timerPhoqueMove = game.mainTimer.addFromObj({
  505.                   "id":"timerPhoqueMove",
  506.                   "delay":game.moduleConfig.levels[level - 1].phoquesSpeed,
  507.                   "onDelay":function(tc:TimerChild):void
  508.                   {
  509.                      trace("phoque move");
  510.                      if(gameFinished)
  511.                      {
  512.                         return;
  513.                      }
  514.                      if(phoqueAll.currentLabel == "FIN")
  515.                      {
  516.                         tc.stop();
  517.                         keyDetecter.enabled = false;
  518.                         keyDetecter.actionReset();
  519.                         if(timerPiegeOuvert != null)
  520.                         {
  521.                            timerPiegeOuvert.reset();
  522.                         }
  523.                         if(piege["opened"])
  524.                         {
  525.                            if(gameFinished)
  526.                            {
  527.                               return;
  528.                            }
  529.                            game.noisePlay({"code":"B_PLOUF"});
  530.                            phoque.gotoAndStop("E2",{"labelLastCallback":function():void
  531.                            {
  532.                               if(gameFinished)
  533.                               {
  534.                                  return;
  535.                               }
  536.                               piege.gotoAndStop("E0");
  537.                               piege.enabled = false;
  538.                               piege["opened"] = false;
  539.                               phoque.gotoAndStop("E1");
  540.                               phoqueAll.gotoAndStop(1);
  541.                               enemiesLaunchedRemove(phoqueAll);
  542.                               trace("levelContinue from phoque");
  543.                               levelContinue();
  544.                            }});
  545.                         }
  546.                         else
  547.                         {
  548.                            if(gameFinished)
  549.                            {
  550.                               return;
  551.                            }
  552.                            mouseVisible = true;
  553.                            game.noisePlay({"code":"B_BOOM"});
  554.                            game.mainTimer.stop();
  555.                            gameFinished = true;
  556.                            game.commentStop();
  557.                            oiseauNoiseVolClean();
  558.                            phoque.gotoAndStop("E3",{"labelLastCallback":function():void
  559.                            {
  560.                               piege.gotoAndStop("E0");
  561.                               piege.enabled = false;
  562.                               piege["opened"] = false;
  563.                               phoque.gotoAndStop("E1");
  564.                               phoqueAll.gotoAndStop(1);
  565.                               enemiesLaunchedRemove(phoqueAll);
  566.                               piste02.onLabelEnter = function(result:*):void
  567.                               {
  568.                                  if(piste02.currentLabel == "FIN")
  569.                                  {
  570.                                     piste02.visible = false;
  571.                                     piste02.stop();
  572.                                     _container.visible = false;
  573.                                     mainTimeline.gotoAndStop("_18_JEU_E2",{"labelLastCallback":function():void
  574.                                     {
  575.                                        mainTimeline.visible = false;
  576.                                        _container.visible = true;
  577.                                        restart();
  578.                                     }});
  579.                                     mainTimeline.visible = true;
  580.                                  }
  581.                               };
  582.                               piste02.play(1);
  583.                            }});
  584.                         }
  585.                      }
  586.                      else
  587.                      {
  588.                         phoqueAll.gotoAndStop(phoqueAll.currentFrame + 1);
  589.                         if(waitKeyDown == false && keyDetecter.actions.down)
  590.                         {
  591.                            trace("up");
  592.                            waitKeyDown = true;
  593.                            piegeOpen();
  594.                         }
  595.                         else if(keyDetecter.actions.down == false)
  596.                         {
  597.                            trace("up false");
  598.                            waitKeyDown = false;
  599.                         }
  600.                      }
  601.                   }
  602.                });
  603.             }
  604.          });
  605.       }
  606.       
  607.       public function piegeInit() : void
  608.       {
  609.          this.piege = this.attente.addActor({
  610.             "mc":this._container.getChildByName("PIEGE") as MovieClip,
  611.             "onRollOverState":{"label":undefined},
  612.             "onRollOutState":{"label":undefined},
  613.             "onClickState":{"label":undefined}
  614.          });
  615.          this.piege["opened"] = false;
  616.          this.piege.initAs();
  617.          this.piege.onClick = function(actor:IActorClip):void
  618.          {
  619.          };
  620.          this.piege.enabled = false;
  621.          this.piege.gotoAndStop("E0");
  622.       }
  623.       
  624.       public function piegeOpen() : void
  625.       {
  626.          this.piege["opened"] = true;
  627.          this.piege.enabled = false;
  628.          this.piege.gotoAndStop("E2");
  629.          this.timerPiegeOuvert = this.game.mainTimer.addFromObj({
  630.             "id":"timerPiegeOuvert",
  631.             "delay":1000,
  632.             "loop":1,
  633.             "onDelay":function(tc:TimerChild):void
  634.             {
  635.                if(gameFinished)
  636.                {
  637.                   return;
  638.                }
  639.                piege.gotoAndStop("E1");
  640.                piege.enabled = true;
  641.                piege["opened"] = false;
  642.             }
  643.          });
  644.       }
  645.       
  646.       public function piste02Init() : void
  647.       {
  648.          this.piste02 = this.attente.addActor({"mc":this._container.getChildByName("PISTE_02") as MovieClip});
  649.       }
  650.       
  651.       public function getNumEnemiesLaunched(type:String = "all") : int
  652.       {
  653.          if(type == "all")
  654.          {
  655.             return this.enemiesLaunched.length;
  656.          }
  657.          var enemy:int = 0;
  658.          this.enemiesLaunched.forEach(function(item:*, index:int, array:Vector.<IActorClip>):void
  659.          {
  660.             if(item["typeEnemy"] == type)
  661.             {
  662.                ++enemy;
  663.             }
  664.          },this);
  665.          return enemy;
  666.       }
  667.       
  668.       protected function enemiesLaunchedAdd(obj:Object) : void
  669.       {
  670.          this.enemiesLaunched.push(obj);
  671.       }
  672.       
  673.       protected function enemiesLaunchedRemove(obj:Object) : void
  674.       {
  675.          this.enemiesLaunched.splice(this.enemiesLaunched.indexOf(obj),1);
  676.       }
  677.       
  678.       public function get mouseVisible() : Boolean
  679.       {
  680.          return this._mouseVisible;
  681.       }
  682.       
  683.       public function set mouseVisible(value:Boolean) : void
  684.       {
  685.          if(value == true)
  686.          {
  687.             Mouse.show();
  688.          }
  689.          else
  690.          {
  691.             Mouse.hide();
  692.          }
  693.          this._mouseVisible = value;
  694.       }
  695.       
  696.       protected function stop() : void
  697.       {
  698.          if(this.attente != null)
  699.          {
  700.          }
  701.       }
  702.       
  703.       public function sleep() : void
  704.       {
  705.          if(this.isSleeping)
  706.          {
  707.             return;
  708.          }
  709.          this.isSleeping = true;
  710.          this.sleepState.mouseVisible = this._mouseVisible;
  711.          this.mouseVisible = true;
  712.       }
  713.       
  714.       public function wake() : void
  715.       {
  716.          if(this.isSleeping == false)
  717.          {
  718.             return;
  719.          }
  720.          this.isSleeping = false;
  721.          this.mouseVisible = this.sleepState.mouseVisible;
  722.       }
  723.       
  724.       public function destroy() : void
  725.       {
  726.          this.stop();
  727.          this.game.mainTimer.stop();
  728.          this.game.mainTimer.removeAllChilds();
  729.          this.mouseVisible = true;
  730.          if(this.attente != null)
  731.          {
  732.             this.attente.dissociate();
  733.             this.attente.destroy();
  734.          }
  735.          this.attente = null;
  736.       }
  737.    }
  738. }
  739.