home *** CD-ROM | disk | FTP | other *** search
- class PlayerBallDepthHandler
- {
- var ball;
- var playerArray;
- function PlayerBallDepthHandler(ball)
- {
- this.ball = ball;
- this.playerArray = new Array();
- }
- function addPlayer(player)
- {
- this.playerArray.push(player);
- }
- function manageDepth()
- {
- var _loc3_ = undefined;
- _loc3_ = 0;
- while(_loc3_ < this.playerArray.length)
- {
- if(this.ball.isBallInAirTest() == true)
- {
- var _loc5_ = this.ball.getMovieClip();
- var _loc4_ = this.playerArray[_loc3_].getMovieClip();
- if(_loc5_.getDepth() < _loc4_.getDepth())
- {
- _loc5_.swapDepths(_loc4_);
- }
- }
- if(this.playerArray[_loc3_].isBallOwnerTest() == true)
- {
- var _loc2_ = this.playerArray[_loc3_].getOrientation();
- _loc5_ = this.ball.getMovieClip();
- _loc4_ = this.playerArray[_loc3_].getMovieClip();
- if(_loc2_ == "N" || _loc2_ == "NE" || _loc2_ == "NW")
- {
- if(_loc4_.getDepth() < _loc5_.getDepth())
- {
- _loc4_.swapDepths(_loc5_);
- }
- }
- if(_loc2_ == "S" || _loc2_ == "SE" || _loc2_ == "SW")
- {
- if(_loc5_.getDepth() < _loc4_.getDepth())
- {
- _loc5_.swapDepths(_loc4_);
- }
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- }
- }
-