home *** CD-ROM | disk | FTP | other *** search
/ Equipe de France et Bonbons / EquipeFrancePromoCD.iso / pages / cs_cadbury / loadergfx.swf / scripts / __Packages / ShootJaugeHandler.as < prev    next >
Encoding:
Text File  |  2006-03-19  |  3.4 KB  |  135 lines

  1. class ShootJaugeHandler
  2. {
  3.    var mc;
  4.    var mcEffect;
  5.    var shootInterruption;
  6.    var jaugeAction;
  7.    var engageShootTimerPhase2;
  8.    var engageShootTimerPhase4;
  9.    var jaugeState;
  10.    var engageShootPhase;
  11.    function ShootJaugeHandler(mc, mcEffect)
  12.    {
  13.       this.mc = mc;
  14.       this.mcEffect = mcEffect;
  15.       this.shootInterruption = false;
  16.       this.jaugeAction = "FixedMin";
  17.       this.engageShootTimerPhase2 = new TimerSynchronizer();
  18.       this.engageShootTimerPhase4 = new TimerSynchronizer();
  19.    }
  20.    function move(x, y)
  21.    {
  22.       this.mc._x = x;
  23.       this.mc._y = y;
  24.    }
  25.    function setInvisible()
  26.    {
  27.       this.mc._visible = false;
  28.    }
  29.    function setVisible()
  30.    {
  31.       this.mc._visible = true;
  32.    }
  33.    function setState(state)
  34.    {
  35.       if(state == 0)
  36.       {
  37.          this.jaugeState = 1;
  38.          return undefined;
  39.       }
  40.       if(state >= 15)
  41.       {
  42.          this.jaugeState = 11;
  43.       }
  44.       else
  45.       {
  46.          this.jaugeState = state;
  47.       }
  48.    }
  49.    function getState()
  50.    {
  51.       return this.mc._currentframe;
  52.    }
  53.    function actionFixedMin()
  54.    {
  55.       this.jaugeAction = "FixedMin";
  56.    }
  57.    function actionEngageShoot()
  58.    {
  59.       this.jaugeAction = "EngageShoot";
  60.       this.engageShootPhase = "Phase1";
  61.       this.mc.gotoAndPlay(1);
  62.    }
  63.    function actionShoot()
  64.    {
  65.       this.shootInterruption = true;
  66.    }
  67.    function operate()
  68.    {
  69.       if(this.shootInterruption == true)
  70.       {
  71.          if(this.jaugeAction == "EngageShoot")
  72.          {
  73.             if(this.engageShootPhase == "Phase1" || this.engageShootPhase == "Phase2")
  74.             {
  75.                this.setState(this.mc._currentframe);
  76.                this.engageShootTimerPhase4.setOldTimer(getTimer());
  77.                this.engageShootPhase = "Phase4";
  78.                this.shootInterruption = false;
  79.                return this.jaugeState;
  80.             }
  81.          }
  82.          this.shootInterruption = false;
  83.          return -1;
  84.       }
  85.       if(this.jaugeAction == "FixedMin")
  86.       {
  87.          this.mc.gotoAndPlay(1);
  88.          return -1;
  89.       }
  90.       if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase1")
  91.       {
  92.          if(this.mc._currentframe == 20)
  93.          {
  94.             this.engageShootTimerPhase2.setOldTimer(getTimer());
  95.             this.engageShootPhase = "Phase2";
  96.          }
  97.          return -1;
  98.       }
  99.       if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase2")
  100.       {
  101.          this.mc.gotoAndPlay(20);
  102.          if(this.engageShootTimerPhase2.getElapsedTimeMs() > 500)
  103.          {
  104.             this.engageShootPhase = "Phase3";
  105.          }
  106.          return -1;
  107.       }
  108.       if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase3")
  109.       {
  110.          var _loc2_ = random(8);
  111.          this.setState(_loc2_);
  112.          this.engageShootTimerPhase4.setOldTimer(getTimer());
  113.          this.engageShootPhase = "Phase4";
  114.          return this.jaugeState;
  115.       }
  116.       if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase4")
  117.       {
  118.          if(this.engageShootTimerPhase4.getElapsedTimeMs() < 1000)
  119.          {
  120.             this.mc.gotoAndPlay(this.jaugeState);
  121.          }
  122.          else
  123.          {
  124.             this.mc.gotoAndPlay(1);
  125.             this.jaugeAction = "FixedMin";
  126.          }
  127.          return -1;
  128.       }
  129.       return -1;
  130.    }
  131.    function trace()
  132.    {
  133.    }
  134. }
  135.