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

  1. class PlayerBallDepthHandler
  2. {
  3.    var ball;
  4.    var playerArray;
  5.    function PlayerBallDepthHandler(ball)
  6.    {
  7.       this.ball = ball;
  8.       this.playerArray = new Array();
  9.    }
  10.    function addPlayer(player)
  11.    {
  12.       this.playerArray.push(player);
  13.    }
  14.    function manageDepth()
  15.    {
  16.       var _loc3_ = undefined;
  17.       _loc3_ = 0;
  18.       while(_loc3_ < this.playerArray.length)
  19.       {
  20.          if(this.ball.isBallInAirTest() == true)
  21.          {
  22.             var _loc5_ = this.ball.getMovieClip();
  23.             var _loc4_ = this.playerArray[_loc3_].getMovieClip();
  24.             if(_loc5_.getDepth() < _loc4_.getDepth())
  25.             {
  26.                _loc5_.swapDepths(_loc4_);
  27.             }
  28.          }
  29.          if(this.playerArray[_loc3_].isBallOwnerTest() == true)
  30.          {
  31.             var _loc2_ = this.playerArray[_loc3_].getOrientation();
  32.             _loc5_ = this.ball.getMovieClip();
  33.             _loc4_ = this.playerArray[_loc3_].getMovieClip();
  34.             if(_loc2_ == "N" || _loc2_ == "NE" || _loc2_ == "NW")
  35.             {
  36.                if(_loc4_.getDepth() < _loc5_.getDepth())
  37.                {
  38.                   _loc4_.swapDepths(_loc5_);
  39.                }
  40.             }
  41.             if(_loc2_ == "S" || _loc2_ == "SE" || _loc2_ == "SW")
  42.             {
  43.                if(_loc5_.getDepth() < _loc4_.getDepth())
  44.                {
  45.                   _loc5_.swapDepths(_loc4_);
  46.                }
  47.             }
  48.          }
  49.          _loc3_ = _loc3_ + 1;
  50.       }
  51.    }
  52. }
  53.