home *** CD-ROM | disk | FTP | other *** search
- class com.leadpipe.attentionhog.Ability
- {
- var target;
- var methodName;
- var controlKey;
- var icon;
- var gauge;
- var isInputType;
- var isDisabled;
- var timerPowerUp;
- var initInputSwitch;
- var powerUpMode;
- var initSwitchPower;
- var initSwitch;
- static var instanceList = new Array();
- function Ability(t, mn, ck, ic, g, i)
- {
- com.leadpipe.attentionhog.Ability.instanceList.push(this);
- this.target = t;
- this.methodName = mn;
- this.controlKey = ck;
- this.icon = ic;
- this.gauge = g;
- this.isInputType = i;
- this.isDisabled = false;
- this.timerPowerUp = new com.leadpipe.attentionhog.Timer(this,"stopPowerUp",7000,7000);
- }
- function check()
- {
- if(this.isDisabled)
- {
- return undefined;
- }
- if(Key.isDown(this.controlKey))
- {
- this.initInputSwitch = this.initInputSwitch + 1;
- }
- else
- {
- this.initInputSwitch = 0;
- }
- if(this.powerUpMode)
- {
- this.initSwitchPower = this.initSwitchPower + 1;
- if(this.isInputType && this.initInputSwitch == 1)
- {
- this.target[this.methodName](true,this.powerUpMode);
- }
- else if(this.isInputType == false && this.initSwitchPower == 1)
- {
- this.initInputSwitch = 0;
- this.target[this.methodName](true,this.powerUpMode);
- }
- }
- else if(Key.isDown(this.controlKey) && this.gauge.getLevel() > 0)
- {
- this.gauge.decrease();
- this.initSwitch = this.initSwitch + 1;
- if(this.initSwitch == 1)
- {
- this.target[this.methodName](true,this.powerUpMode);
- }
- }
- else
- {
- if(this.initSwitch > 0)
- {
- this.target[this.methodName](false,this.powerUpMode);
- }
- this.initSwitch = 0;
- }
- }
- function startPowerUp()
- {
- this.powerUpMode = true;
- this.initSwitchPower = 0;
- this.timerPowerUp.start();
- this.icon.gotoAndStop("super");
- }
- function stopPowerUp()
- {
- this.timerPowerUp.clear();
- this.powerUpMode = false;
- this.target[this.methodName](false,this.powerUpMode);
- this.initSwitch = 0;
- this.icon.gotoAndStop(1);
- }
- function setDisabled(d)
- {
- this.isDisabled = d;
- if(this.isDisabled)
- {
- this.timerPowerUp.clear();
- this.target[this.methodName](false,false);
- this.initSwitch = 0;
- this.powerUpMode = false;
- this.icon.gotoAndStop(1);
- }
- }
- static function checkAll()
- {
- for(var _loc1_ in com.leadpipe.attentionhog.Ability.instanceList)
- {
- com.leadpipe.attentionhog.Ability.instanceList[_loc1_].check();
- }
- }
- static function stopPowerUpAll()
- {
- for(var _loc1_ in com.leadpipe.attentionhog.Ability.instanceList)
- {
- com.leadpipe.attentionhog.Ability.instanceList[_loc1_].stopPowerUp();
- }
- }
- static function disableAll(d)
- {
- for(var _loc2_ in com.leadpipe.attentionhog.Ability.instanceList)
- {
- com.leadpipe.attentionhog.Ability.instanceList[_loc2_].setDisabled(d);
- }
- }
- }
-