home *** CD-ROM | disk | FTP | other *** search
- class ShootJaugeHandler
- {
- var mc;
- var mcEffect;
- var shootInterruption;
- var jaugeAction;
- var engageShootTimerPhase2;
- var engageShootTimerPhase4;
- var jaugeState;
- var engageShootPhase;
- function ShootJaugeHandler(mc, mcEffect)
- {
- this.mc = mc;
- this.mcEffect = mcEffect;
- this.shootInterruption = false;
- this.jaugeAction = "FixedMin";
- this.engageShootTimerPhase2 = new TimerSynchronizer();
- this.engageShootTimerPhase4 = new TimerSynchronizer();
- }
- function move(x, y)
- {
- this.mc._x = x;
- this.mc._y = y;
- }
- function setInvisible()
- {
- this.mc._visible = false;
- }
- function setVisible()
- {
- this.mc._visible = true;
- }
- function setState(state)
- {
- if(state == 0)
- {
- this.jaugeState = 1;
- return undefined;
- }
- if(state >= 15)
- {
- this.jaugeState = 11;
- }
- else
- {
- this.jaugeState = state;
- }
- }
- function getState()
- {
- return this.mc._currentframe;
- }
- function actionFixedMin()
- {
- this.jaugeAction = "FixedMin";
- }
- function actionEngageShoot()
- {
- this.jaugeAction = "EngageShoot";
- this.engageShootPhase = "Phase1";
- this.mc.gotoAndPlay(1);
- }
- function actionShoot()
- {
- this.shootInterruption = true;
- }
- function operate()
- {
- if(this.shootInterruption == true)
- {
- if(this.jaugeAction == "EngageShoot")
- {
- if(this.engageShootPhase == "Phase1" || this.engageShootPhase == "Phase2")
- {
- this.setState(this.mc._currentframe);
- this.engageShootTimerPhase4.setOldTimer(getTimer());
- this.engageShootPhase = "Phase4";
- this.shootInterruption = false;
- return this.jaugeState;
- }
- }
- this.shootInterruption = false;
- return -1;
- }
- if(this.jaugeAction == "FixedMin")
- {
- this.mc.gotoAndPlay(1);
- return -1;
- }
- if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase1")
- {
- if(this.mc._currentframe == 20)
- {
- this.engageShootTimerPhase2.setOldTimer(getTimer());
- this.engageShootPhase = "Phase2";
- }
- return -1;
- }
- if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase2")
- {
- this.mc.gotoAndPlay(20);
- if(this.engageShootTimerPhase2.getElapsedTimeMs() > 500)
- {
- this.engageShootPhase = "Phase3";
- }
- return -1;
- }
- if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase3")
- {
- var _loc2_ = random(8);
- this.setState(_loc2_);
- this.engageShootTimerPhase4.setOldTimer(getTimer());
- this.engageShootPhase = "Phase4";
- return this.jaugeState;
- }
- if(this.jaugeAction == "EngageShoot" && this.engageShootPhase == "Phase4")
- {
- if(this.engageShootTimerPhase4.getElapsedTimeMs() < 1000)
- {
- this.mc.gotoAndPlay(this.jaugeState);
- }
- else
- {
- this.mc.gotoAndPlay(1);
- this.jaugeAction = "FixedMin";
- }
- return -1;
- }
- return -1;
- }
- function trace()
- {
- }
- }
-