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

  1. class PlayerSpeedHandler
  2. {
  3.    var speed;
  4.    var playerFramerate;
  5.    var boostState;
  6.    var boostPower;
  7.    var BOOSTCONST;
  8.    var boostLock;
  9.    var boostJauge;
  10.    var timer;
  11.    var mcBoostJauge;
  12.    var mcTrainee;
  13.    function PlayerSpeedHandler(mcBoostJauge, mcTrainee)
  14.    {
  15.       this.speed = 3.5;
  16.       this.playerFramerate = 40;
  17.       this.boostState = false;
  18.       this.boostPower = 1;
  19.       this.BOOSTCONST = 2;
  20.       this.boostLock = false;
  21.       this.boostJauge = 100;
  22.       this.timer = new TimerSynchronizer();
  23.       this.mcBoostJauge = mcBoostJauge;
  24.       this.mcTrainee = mcTrainee;
  25.    }
  26.    function setSpeed(speed)
  27.    {
  28.       this.speed = speed;
  29.    }
  30.    function setBoostState(bool)
  31.    {
  32.       this.boostState = bool;
  33.    }
  34.    function setBoostPower(coef)
  35.    {
  36.       this.boostPower = coef;
  37.    }
  38.    function setBoostLock(bool)
  39.    {
  40.       this.boostLock = bool;
  41.    }
  42.    function setBoostJauge(capacity)
  43.    {
  44.       this.boostJauge = capacity;
  45.    }
  46.    function getSpeed()
  47.    {
  48.       return this.speed;
  49.    }
  50.    function getBoostState()
  51.    {
  52.       return this.boostState;
  53.    }
  54.    function getBoostPower()
  55.    {
  56.       return this.boostPower;
  57.    }
  58.    function getBoostLock()
  59.    {
  60.       return this.boostLock;
  61.    }
  62.    function getBoostJauge()
  63.    {
  64.       return this.boostJauge;
  65.    }
  66.    function getBOOSTCONST()
  67.    {
  68.       return this.BOOSTCONST;
  69.    }
  70.    function getPlayerFramerate()
  71.    {
  72.       return this.playerFramerate;
  73.    }
  74.    function boostActivation()
  75.    {
  76.       this.boostPower = this.BOOSTCONST;
  77.       this.boostState = true;
  78.    }
  79.    function boostDesactivation()
  80.    {
  81.       this.boostPower = 1;
  82.       this.boostState = false;
  83.    }
  84.    function boostAnalyser()
  85.    {
  86.       var _loc2_ = this.timer.getElapsedTimeMs();
  87.       if(this.boostJauge <= 5)
  88.       {
  89.          this.boostDesactivation();
  90.          this.mcBoostJauge._visible = false;
  91.          this.mcTrainee._visible = false;
  92.       }
  93.       if(this.boostJauge > 6)
  94.       {
  95.          this.mcBoostJauge._visible = true;
  96.       }
  97.       if(_loc2_ >= 10)
  98.       {
  99.          if(this.boostState == false)
  100.          {
  101.             if(this.boostJauge < 100)
  102.             {
  103.                this.mcTrainee._visible = false;
  104.                this.boostJauge += 1;
  105.                this.mcBoostJauge._xscale = this.boostJauge;
  106.                this.playerFramerate = 40;
  107.             }
  108.          }
  109.          if(this.boostState == true && this.boostLock == false)
  110.          {
  111.             if(this.boostJauge >= 0)
  112.             {
  113.                if(this.boostJauge > 6)
  114.                {
  115.                   this.mcTrainee._visible = true;
  116.                }
  117.                this.boostJauge -= 5;
  118.                this.mcBoostJauge._xscale = this.boostJauge;
  119.                this.playerFramerate = 20;
  120.             }
  121.          }
  122.          this.timer.setOldTimer(getTimer());
  123.       }
  124.    }
  125. }
  126.