home *** CD-ROM | disk | FTP | other *** search
- class BuildingPart extends smashing.Renderable
- {
- var mcGerm = null;
- function BuildingPart()
- {
- super();
- }
- function init(oHandler, bObst, nType, oBData, segment)
- {
- var _loc1_ = this;
- var _loc2_ = bObst;
- _loc1_.hasObstacle = _loc2_;
- _loc1_.bhandler = oHandler;
- _loc1_.oData = oBData;
- _loc1_.nSegment = segment;
- if(_loc2_ == true)
- {
- _loc1_.gotoAndStop("obst");
- }
- else
- {
- _loc1_.gotoAndStop("open");
- }
- _loc1_.gfx.gotoAndStop(nType);
- _loc1_.aLines = [];
- if(_loc2_ == true)
- {
- if(_loc1_.gfx.p3 == undefined)
- {
- if(_loc1_.gfx.p2 == undefined)
- {
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p0._x + _loc1_.x,_loc1_.gfx.p0._y + _loc1_.y,_loc1_.gfx.p1._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y));
- }
- else
- {
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p0._x + _loc1_.x,_loc1_.gfx.p0._y + _loc1_.y,_loc1_.gfx.p1._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y));
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p1._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y,_loc1_.gfx.p2._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y));
- }
- }
- else
- {
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p0._x + _loc1_.x,_loc1_.gfx.p0._y + _loc1_.y,_loc1_.gfx.p1._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y));
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p1._x + _loc1_.x,_loc1_.gfx.p1._y + _loc1_.y,_loc1_.gfx.p2._x + _loc1_.x,_loc1_.gfx.p2._y + _loc1_.y));
- _loc1_.aLines.push(new smashing.Line(_loc1_.gfx.p2._x + _loc1_.x,_loc1_.gfx.p2._y + _loc1_.y,_loc1_.gfx.p3._x + _loc1_.x,_loc1_.gfx.p3._y + _loc1_.y));
- }
- }
- }
- function render()
- {
- var _loc1_ = this;
- var _loc2_ = smashing.Viewport.getPos(_loc1_);
- if(_loc2_.x < BuildingHandler.leftEdge || _loc2_.x > smashing.Viewport.halfWidth)
- {
- var _loc3_ = false;
- _loc1_.bhandler.removeBuilding(_loc1_,_loc3_);
- }
- else if(_loc2_.y > smashing.Viewport.halfHeight || _loc2_.y < BuildingHandler.topEdge - _loc1_.spacerY._y)
- {
- _loc1_._visible = false;
- }
- else
- {
- _loc1_._visible = true;
- _loc1_._x = _loc2_.x + smashing.Viewport.centerX;
- _loc1_._y = _loc2_.y + smashing.Viewport.centerY;
- }
- }
- }
-