|
@@ -420,28 +420,28 @@ export class car extends Component {
|
|
|
// let rect = this.node.getComponent(UITransform).getBoundingBox()
|
|
|
let list = this.game_manager.carCollider(rect)
|
|
|
if(list.length>0){
|
|
|
- // for (let index = 0; index < list.length; index++) {
|
|
|
- // const element = list[index];
|
|
|
- // if(element.collider_dir==config.collider_dir.top){
|
|
|
- // y = this.node.position.y
|
|
|
- // if(element.type==0){
|
|
|
- // this.onColliderBox(element.node)
|
|
|
- // }else if(element.type==1){
|
|
|
- // x-=element.moveOffset
|
|
|
- // // console.log("carCollider wall",element)
|
|
|
- // }
|
|
|
- // }else{
|
|
|
- // // x = this.node.position.x
|
|
|
+ for (let index = 0; index < list.length; index++) {
|
|
|
+ const element = list[index];
|
|
|
+ if(element.collider_dir==config.collider_dir.top){
|
|
|
+ y = this.node.position.y
|
|
|
+ if(element.type==0){
|
|
|
+ this.onColliderBox(element.node)
|
|
|
+ }else if(element.type==1){
|
|
|
+ x-=element.moveOffset
|
|
|
+ // console.log("carCollider wall",element)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // x = this.node.position.x
|
|
|
|
|
|
- // if(element.type==2){
|
|
|
- // this.onColliderCoin(element.node)
|
|
|
- // }else if(element.type==1||element.type==0){
|
|
|
- // if(element.moveOffset==0){
|
|
|
- // x = this.node.position.x
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ if(element.type==2){
|
|
|
+ this.onColliderCoin(element.node)
|
|
|
+ }else if(element.type==1||element.type==0){
|
|
|
+ if(element.moveOffset==0){
|
|
|
+ x = this.node.position.x
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// this._curRingPos_1.set(0, 0, 0);
|
|
@@ -460,7 +460,7 @@ export class car extends Component {
|
|
|
}
|
|
|
}
|
|
|
this.offsetY =Math.abs(this.origin_pos_y-y)
|
|
|
- let dir = new Vec3(this.map.position.x,-this.offsetY,this.map.position.z)
|
|
|
+ let dir = new Vec3(0,-this.offsetY,this.map.position.z)
|
|
|
this.map.position = dir
|
|
|
this.node.setPosition(x,y)
|
|
|
}
|
|
@@ -478,7 +478,10 @@ export class car extends Component {
|
|
|
if(!this.isStartGame){
|
|
|
return
|
|
|
}
|
|
|
- this.speed_bei = dis / 8
|
|
|
+ if(Math.abs(dis) <1){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.speed_bei = Math.abs(dis / 8)
|
|
|
if(this.speed_bei>4){
|
|
|
dis*=4
|
|
|
Tween.stopAllByTarget(this.smoke_particle.node)
|