Ver código fonte

最新覆盖

woso_javan 4 meses atrás
pai
commit
9c50a57ea0

+ 27 - 8
assets/module_movecar/Prefabs/CarColorsLevels/lvl_2.prefab

@@ -61,14 +61,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 128
+        "__id__": 130
       },
       {
-        "__id__": 130
+        "__id__": 132
       }
     ],
     "_prefab": {
-      "__id__": 132
+      "__id__": 134
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -1713,6 +1713,9 @@
       },
       {
         "__id__": 127
+      },
+      {
+        "__id__": 128
       }
     ],
     "removedComponents": []
@@ -1760,8 +1763,8 @@
       "__type__": "cc.Quat",
       "x": 0,
       "y": 0,
-      "z": 0,
-      "w": 1
+      "z": 1,
+      "w": 6.123233995736766e-17
     }
   },
   {
@@ -1776,9 +1779,25 @@
       "__type__": "cc.Vec3",
       "x": 0,
       "y": 0,
-      "z": 0
+      "z": 180
     }
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 129
+    },
+    "propertyPath": [
+      "carDir"
+    ],
+    "value": 1
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "b5IAEwCNdMaLP1/q+CJgOW"
+    ]
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -1789,7 +1808,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 129
+      "__id__": 131
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -1817,7 +1836,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 131
+      "__id__": 133
     },
     "_id": ""
   },

+ 39 - 39
assets/module_movecar/RoosterMoveCar.ts

@@ -38,7 +38,7 @@ export class RoosterMoveCar extends Component {
 
     async startGame() {
         //DOTO 获取保存等级
-        LevelManager.instance.levelModel.level = 1;
+        LevelManager.instance.levelModel.level = 2;
         await LevelManager.instance.gameStart();
     }
 
@@ -149,7 +149,7 @@ export class RoosterMoveCar extends Component {
                 let tweenCar: Tween<Node> = tween(car)
                 if (collider.node.name === "PhysicRoodTop") {
                     // this.hitPointTween(car, parkPoint, tweenCar, collider.node)
-                    this.hitPointTween2(car, targetWorldPos, tweenCar, collider.node)
+                    this.hitPointTween2(car, targetWorldPos, tweenCar, collider.node, parkPoint)
                     this.topRoadTween(car, parkPoint, tweenCar)
                 } else if (collider.node.name === "PhysicRoodLeft") {
                     const targetPoint = find("Canvas/Scene/Grounds/PhysicRoodTop/LeftPoint")
@@ -227,7 +227,7 @@ export class RoosterMoveCar extends Component {
      *@param tweenCar 车的tween动画
      *@param hitPoint street碰撞点
     */
-    hitPointTween2(car: Node, targetWorldPos: Vec2, tweenCar: Tween<Node>, hitPoint: Node = null) {
+    hitPointTween2(car: Node, targetWorldPos: Vec2, tweenCar: Tween<Node>, hitPoint: Node = null, parkPoint?: Node) {
         CarUnscrewAudioMgr.playOneShot(CarUnscrewAudioMgr.getMusicIdName(4), 1.0);
 
         const targetV3 = new Vec3(targetWorldPos.x, targetWorldPos.y, 0);
@@ -253,18 +253,31 @@ export class RoosterMoveCar extends Component {
                     }
                 } else {
                     // 上下方向
-                    // up = direction.y > 0 ? new Vec3(0, -1, 0) : new Vec3(0, 1, 0);
                     // console.log('hitPoint.name:', hitPoint.name);
                     if (hitPoint.name == 'PhysicRoodBottom' || hitPoint.name == 'PhysicRoodTop') {
-                        const leftPoint = hitPoint.getChildByName('LeftPoint')!;
-                        const rightPoint = hitPoint.getChildByName('RightPoint')!;
-                        const toLeft = leftPoint.getWorldPosition().subtract(carWorldPos).normalize();
-                        const toRight = rightPoint.getWorldPosition().subtract(carWorldPos).normalize();
-
-                        if (Math.abs(toLeft.x) < Math.abs(toRight.x)) {
-                            up = new Vec3(0, 0, 1);
+                        if (hitPoint.name == 'PhysicRoodTop') {
+                            //车找相对停车位的方向
+                            const carWorldPos = car.getWorldPosition().clone();
+                            const parkWorldPos = parkPoint.getWorldPosition().clone();
+                            const direction = carWorldPos.subtract(parkWorldPos).normalize();
+
+                            if (direction.x > 0) {
+                                up = new Vec3(0, 0, 1);
+                            } else {
+                                up = new Vec3(0, 0, -1);
+                            }
                         } else {
-                            up = new Vec3(0, 0, -1);
+                            const leftPoint = hitPoint.getChildByName('LeftPoint')!;
+                            const rightPoint = hitPoint.getChildByName('RightPoint')!;
+
+                            const toLeft = leftPoint.getWorldPosition().subtract(targetV3).normalize();
+                            const toRight = rightPoint.getWorldPosition().subtract(targetV3).normalize();
+
+                            if (Math.abs(toLeft.x) <= Math.abs(toRight.x)) {
+                                up = new Vec3(0, 0, 1);
+                            } else {
+                                up = new Vec3(0, 0, -1);
+                            }
                         }
                     } else {
                         up = direction.y > 0 ? new Vec3(0, -1, 0) : new Vec3(0, 1, 0);
@@ -277,36 +290,29 @@ export class RoosterMoveCar extends Component {
 
     // 顶部导航
     topRoadTween(car: Node, targetPoint: Node, tweenCar: Tween<Node>) {
-        tweenCar.to(duration, {
-            worldPosition: targetPoint.getWorldPosition()
-        })
-            .call(() => {
-                const carforward = car.forward.clone()
-                tween(carforward).to(0.1, { x: 0, y: 0, z: 0 }, {
-                    onUpdate: () => {
-                        car.forward = carforward
-                    }
-                }).start()
-
-                car.getComponent(CarCarColorsComponent).openCover();
+        const targetWorldPos = targetPoint.worldPosition.clone();
+        tweenCar
+            .to(duration, {
+                worldPosition: new Vec3(targetWorldPos.x, targetWorldPos.y - 70, targetWorldPos.z)
+            })
+            .delay(0.1)
+            .to(duration, {
+                eulerAngles: new Vec3(0, 0, 0)
             })
             .delay(0.1)
             .to(duration, {
-                worldPosition: targetPoint.getWorldPosition()
+                worldPosition: targetPoint.worldPosition
+            })
+            .call(() => {
+                car.getComponent(CarCarColorsComponent)!.openCover();
             })
     }
 
-    //左边顶部转向右
+    /** 顶部左边转向右*/
     leftTopToRight(car: Node, targetPoint: Node, tweenCar: Tween<Node>) {
-        //转向右边动画
-        const targetWorldPos = targetPoint.getWorldPosition().clone()
         tweenCar.to(0.2, {
             eulerAngles: new Vec3(0, 0, -90)
         })
-            .delay(0.1)
-            .to(0.2, { worldPosition: new Vec3(targetWorldPos.x, targetWorldPos.y, targetWorldPos.z) })
-            .delay(0.1)
-            .to(0.2, { eulerAngles: new Vec3(0, 0, 0) })
             .start()
     }
 
@@ -327,17 +333,11 @@ export class RoosterMoveCar extends Component {
             .delay(0.1)
     }
 
-    //右边顶部转向左
+    /** 顶部右边转向左*/
     rightTopToleft(car: Node, targetPoint: Node, tweenCar: Tween<Node>) {
-        //转向左边动画
-        const targetWorldPos = targetPoint.getWorldPosition().clone()
         tweenCar.to(0.2, {
             eulerAngles: new Vec3(0, 0, 90)
         })
-            .delay(0.1)
-            .to(0.2, { worldPosition: new Vec3(targetWorldPos.x, targetWorldPos.y, targetWorldPos.z) })
-            .delay(0.1)
-            .to(0.2, { eulerAngles: new Vec3(0, 0, 0) })
             .start()
     }
 

+ 1 - 1
assets/module_movecar/Script/Components/CarCarColorsComponent.ts

@@ -100,7 +100,7 @@ export class CarCarColorsComponent extends Component {
 
         role.removeFromParent()
         tween(new_pin)
-            .to(0.2, {
+            .to(0.5, {
                 worldPosition: new Vec3(seatWorldPos.x, seatWorldPos.y, 0)
             })
             .call(() => {

+ 1 - 0
assets/module_movecar/Script/Components/PinComponent.ts

@@ -22,6 +22,7 @@ export class PinComponent extends Component {
     private _pin_color: CarColors = CarColors.Purple
 
     isBlocked: boolean = false;
+    isProcessing: boolean = false;
     pos_hole: HoleComponent = null;
 
     start() {

+ 1 - 1
assets/module_movecar/Script/ElementAction.ts

@@ -36,7 +36,7 @@ export class ElementAction extends Component {
 
 
         const pins = this.node.getComponentsInChildren(PinComponent)!;
-        console.log('检测是否还有钉子:', pins.length)
+        // console.log('检测是否还有钉子:', pins.length)
         if (pins.length == 0) {
             console.log("没有钉子 Element刚体变成动力学");
             this.node.getComponent(RigidBody2D).type = ERigidBody2DType.Dynamic;

+ 1 - 1
assets/module_movecar/Script/LevelAction.ts

@@ -18,7 +18,7 @@ export class LevelAction extends Component {
     start() {
         this.registerListener();
         this.init_level();
-        this.schedule(this.moveToCar, 0.5);
+        this.schedule(this.moveToCar, 1);
     }
 
     registerListener() {

+ 14 - 14
assets/module_movecar/rooster_movecar.scene

@@ -102,7 +102,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 380,
-      "y": 799.9999999999999,
+      "y": 800,
       "z": 0
     },
     "_lrot": {
@@ -187,7 +187,7 @@
     "_priority": 1073741824,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 799.9999999999999,
+    "_orthoHeight": 800,
     "_near": 1,
     "_far": 2000,
     "_color": {
@@ -283,7 +283,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 760,
-      "height": 1599.9999999999998
+      "height": 1600
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -3562,7 +3562,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -400,
-      "y": -225,
+      "y": -230,
       "z": 0
     },
     "_lrot": {
@@ -3851,7 +3851,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 600,
+      "width": 570,
       "height": 50
     },
     "_anchorPoint": {
@@ -3942,7 +3942,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 600,
+      "width": 570,
       "height": 50
     },
     "_anchorPoint": {
@@ -4003,7 +4003,7 @@
     },
     "_size": {
       "__type__": "cc.Size",
-      "width": 600,
+      "width": 570,
       "height": 50
     },
     "_id": "4fi/lDzEhDD4f0HRLUFC4j"
@@ -4046,7 +4046,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 400,
-      "y": -225,
+      "y": -230,
       "z": 0
     },
     "_lrot": {
@@ -4426,7 +4426,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 600,
+      "width": 570,
       "height": 50
     },
     "_anchorPoint": {
@@ -4487,7 +4487,7 @@
     },
     "_size": {
       "__type__": "cc.Size",
-      "width": 600,
+      "width": 570,
       "height": 50
     },
     "_id": "0dwGTvdltPNrzSHUSUjHf8"
@@ -4505,7 +4505,7 @@
     "_alignFlags": 32,
     "_target": null,
     "_left": 0,
-    "_right": -650,
+    "_right": -635,
     "_top": 0,
     "_bottom": 0,
     "_horizontalCenter": 0,
@@ -4637,7 +4637,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -700,
+      "y": -700.0000000000001,
       "z": 0
     },
     "_lrot": {
@@ -6324,7 +6324,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 760,
-      "height": 1599.9999999999998
+      "height": 1600
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -6463,7 +6463,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 760,
-      "height": 1599.9999999999998
+      "height": 1600
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",