var game2;!function(e){var t=function(){function t(){this._planeParent=null,this._planePosZ=-40,this._obstacleParent=null,this._obstaclePosZ=-55,this._accelerateParent=null,this._acceleratePosZ=-7,this._buildingParent=null,this._buildingPosZ=20,this._planeParent=new Laya.MeshSprite3D,this._obstacleParent=new Laya.MeshSprite3D,this._accelerateParent=new Laya.MeshSprite3D,this._buildingParent=new Laya.MeshSprite3D}return t.prototype.reset=function(){this._planePosZ=-40,this._obstaclePosZ=-55,this._acceleratePosZ=-7,this._buildingPosZ=20},t.prepare=function(){e.PlaneBlock.prepare(),e.ObstacleBlock.parepare(),e.AccelerateBlock.parepare(),e.BuildingBlock.parepare()},t.prototype.addToScene=function(e){e.addChild(this._planeParent),e.addChild(this._obstacleParent),e.addChild(this._accelerateParent),e.addChild(this._buildingParent)},t.prototype.setup=function(){this._addNextPlane()},t.prototype.addPlane=function(t,a,i){var n=e.PlaneBlock.create();return n.meshRender.material.setFogColor(touch.SkinManager.fogColors[0]),n.transform.position=new Laya.Vector3(t,a,i),this._planeParent.addChild(n),n},t.prototype._addNextPlane=function(){this.addPlane(0,0,this._planePosZ),this._planePosZ-=100},t.prototype._addNextObstacle=function(){var t=e.MyUtils.randomInt(-2,3);this._addGameBlock(e.ObstacleBlock.create,this._obstacleParent,{x:t,y:.5,z:this._obstaclePosZ}),this._obstaclePosZ-=20},t.prototype._addNextAccelerateBlock=function(){var t=e.MyUtils.randomInt(-2,3);this._addGameBlock(e.AccelerateBlock.create,this._accelerateParent,{x:t,y:0,z:this._acceleratePosZ}),this._acceleratePosZ-=20},t.prototype._addNextBuildingBlock=function(){var t=e.MyUtils.randomInt(-17,6);console.info("Building Z: "+this._buildingPosZ+", Y: "+t),this._addGameBlock(e.BuildingBlock.create,this._buildingParent,{x:7,y:t,z:this._buildingPosZ}),t=e.MyUtils.randomInt(-17,6),this._addGameBlock(e.BuildingBlock.create,this._buildingParent,{x:-7,y:t,z:this._buildingPosZ}),this._buildingPosZ-=20},t.prototype._addGameBlock=function(e,t,a){var i=e();return t.addChild(i),i.transform.localPosition=new Laya.Vector3(a.x,a.y,a.z),i},t.prototype.updateWorld=function(e,t){var a=t.transform.position.z;this._addNextGameBlock(this._addNextPlane,a,this._planePosZ,130),this._addNextGameBlock(this._addNextObstacle,a,this._obstaclePosZ,60),this._addNextGameBlock(this._addNextAccelerateBlock,a,this._acceleratePosZ,60),this._addNextGameBlock(this._addNextBuildingBlock,a,this._buildingPosZ,70),this._recycle(a)},t.prototype._addNextGameBlock=function(e,t,a,i){t-a<=i&&e.call(this)},t.prototype._recycle=function(e){this._recycleGameBlocks(this._planeParent,70,e),this._recycleGameBlocks(this._obstacleParent,0,e),this._recycleGameBlocks(this._accelerateParent,0,e),this._recycleGameBlocks(this._buildingParent,0,e)},t.prototype._recycleGameBlocks=function(e,t,a){for(var i=e.numChildren-1;-1a+t&&(n.removeSelf(),n.recycle&&n.recycle())}},t.prototype.updateBendEffectAndDistance=function(t,a){e.GameRenderer.setBendAngleAndDistanceRecursive(this._planeParent,t,a,-1),e.GameRenderer.setBendAngleAndDistanceRecursive(this._obstacleParent,t,a,-1),e.GameRenderer.setBendAngleAndDistanceRecursive(this._accelerateParent,t,a,-1),e.GameRenderer.setBendAngleAndDistanceRecursive(this._buildingParent,t,a,-1)},t.prototype.getAllObstacles=function(){return this._obstacleParent._childs},t.CONFIG={PLANE_DISTANCE:100,OBSTACLE_DISTANCE:60},t}();e.GameWorld=t}(game2||(game2={}));