Commit 2972f601 authored by haiyoucuv's avatar haiyoucuv

init

parent db2d8dc5
...@@ -25,16 +25,16 @@ ...@@ -25,16 +25,16 @@
"__id__": 17 "__id__": 17
}, },
{ {
"__id__": 34 "__id__": 32
}, },
{ {
"__id__": 49 "__id__": 47
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 66 "__id__": 64
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
"__id__": 17 "__id__": 17
}, },
"asset": { "asset": {
"__uuid__": "1d050780-084a-4a94-89dc-105ed985a981", "__uuid__": "dd50f117-884d-42a5-af5a-a80c6271db0d",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"fileId": "ca6ZXggr1OPpZ1elxoE4VX", "fileId": "ca6ZXggr1OPpZ1elxoE4VX",
...@@ -273,16 +273,16 @@ ...@@ -273,16 +273,16 @@
}, },
"targetOverrides": [ "targetOverrides": [
{ {
"__id__": 29 "__id__": 27
}, },
{ {
"__id__": 32 "__id__": 30
} }
] ]
}, },
{ {
"__type__": "cc.PrefabInstance", "__type__": "cc.PrefabInstance",
"fileId": "aae/c2DrxJOLchCPcaOgVX", "fileId": "19yIasO0NAn4hLhfOFP3tK",
"prefabRootNode": { "prefabRootNode": {
"__id__": 1 "__id__": 1
}, },
...@@ -303,9 +303,6 @@ ...@@ -303,9 +303,6 @@
}, },
{ {
"__id__": 25 "__id__": 25
},
{
"__id__": 27
} }
], ],
"removedComponents": [] "removedComponents": []
...@@ -318,7 +315,7 @@ ...@@ -318,7 +315,7 @@
"propertyPath": [ "propertyPath": [
"_name" "_name"
], ],
"value": "Sedan" "value": "Car4"
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
...@@ -336,9 +333,9 @@ ...@@ -336,9 +333,9 @@
], ],
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -1.2899999618530273, "x": -1.446,
"y": 1.4901161415892261e-9, "y": 0,
"z": -1.2900018692016602 "z": -1.446
} }
}, },
{ {
...@@ -352,9 +349,9 @@ ...@@ -352,9 +349,9 @@
"value": { "value": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0.9238795042037964, "y": 0.9238795302952961,
"z": 0, "z": 0,
"w": -0.3826833963394165 "w": -0.3826834377149643
} }
}, },
{ {
...@@ -368,7 +365,7 @@ ...@@ -368,7 +365,7 @@
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -134.99999933643895, "y": -134.99999933643898,
"z": 0 "z": 0
} }
}, },
...@@ -388,23 +385,6 @@ ...@@ -388,23 +385,6 @@
"6cFLC99U1Dl405ygHuNfbi" "6cFLC99U1Dl405ygHuNfbi"
] ]
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 28
},
"propertyPath": [
"_active"
],
"value": true
},
{
"__type__": "cc.TargetInfo",
"localID": [
"ebXDWV+WtBwbX0k+wUYtEb",
"a8lysz3G9WsJw3sNfEgO5Z"
]
},
{ {
"__type__": "cc.TargetOverrideInfo", "__type__": "cc.TargetOverrideInfo",
"source": null, "source": null,
...@@ -413,10 +393,10 @@ ...@@ -413,10 +393,10 @@
"bodyMesh" "bodyMesh"
], ],
"target": { "target": {
"__id__": 30 "__id__": 28
}, },
"targetInfo": { "targetInfo": {
"__id__": 31 "__id__": 29
} }
}, },
{ {
...@@ -426,7 +406,7 @@ ...@@ -426,7 +406,7 @@
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
"localID": [ "localID": [
"a8KAKbpytWQIj9beYfhm7E" "a0jw0F0+Rb0ob933IpHVaW"
] ]
}, },
{ {
...@@ -437,16 +417,16 @@ ...@@ -437,16 +417,16 @@
"top" "top"
], ],
"target": { "target": {
"__id__": 30 "__id__": 28
}, },
"targetInfo": { "targetInfo": {
"__id__": 33 "__id__": 31
} }
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
"localID": [ "localID": [
"49vJjWyDlSg5SO/dJHjbmh" "3fjX4tiM9XiqeFm0MyZrGs"
] ]
}, },
{ {
...@@ -456,14 +436,14 @@ ...@@ -456,14 +436,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 35 "__id__": 33
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 34 "__id__": 32
}, },
"asset": { "asset": {
"__uuid__": "e9d96308-84db-4157-8abd-43bd86b1b985", "__uuid__": "e9d96308-84db-4157-8abd-43bd86b1b985",
...@@ -471,14 +451,14 @@ ...@@ -471,14 +451,14 @@
}, },
"fileId": "6b9c9AH31BepEFqW2vpkx7", "fileId": "6b9c9AH31BepEFqW2vpkx7",
"instance": { "instance": {
"__id__": 36 "__id__": 34
}, },
"targetOverrides": [ "targetOverrides": [
{ {
"__id__": 44 "__id__": 42
}, },
{ {
"__id__": 47 "__id__": 45
} }
] ]
}, },
...@@ -492,19 +472,19 @@ ...@@ -492,19 +472,19 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 37 "__id__": 35
}, },
{ {
"__id__": 39 "__id__": 37
}, },
{ {
"__id__": 40 "__id__": 38
}, },
{ {
"__id__": 41 "__id__": 39
}, },
{ {
"__id__": 42 "__id__": 40
} }
], ],
"removedComponents": [] "removedComponents": []
...@@ -512,7 +492,7 @@ ...@@ -512,7 +492,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 38 "__id__": 36
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
...@@ -528,7 +508,7 @@ ...@@ -528,7 +508,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 38 "__id__": 36
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
...@@ -543,7 +523,7 @@ ...@@ -543,7 +523,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 38 "__id__": 36
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
...@@ -559,7 +539,7 @@ ...@@ -559,7 +539,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 38 "__id__": 36
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
...@@ -574,7 +554,7 @@ ...@@ -574,7 +554,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 43 "__id__": 41
}, },
"propertyPath": [ "propertyPath": [
"_carColor" "_carColor"
...@@ -595,10 +575,10 @@ ...@@ -595,10 +575,10 @@
"bodyMesh" "bodyMesh"
], ],
"target": { "target": {
"__id__": 45 "__id__": 43
}, },
"targetInfo": { "targetInfo": {
"__id__": 46 "__id__": 44
} }
}, },
{ {
...@@ -619,10 +599,10 @@ ...@@ -619,10 +599,10 @@
"top" "top"
], ],
"target": { "target": {
"__id__": 45 "__id__": 43
}, },
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 46
} }
}, },
{ {
...@@ -638,14 +618,14 @@ ...@@ -638,14 +618,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 50 "__id__": 48
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 49 "__id__": 47
}, },
"asset": { "asset": {
"__uuid__": "725a11fb-b865-4f16-b582-9bf848fd6a91", "__uuid__": "725a11fb-b865-4f16-b582-9bf848fd6a91",
...@@ -653,14 +633,14 @@ ...@@ -653,14 +633,14 @@
}, },
"fileId": "9cEQF8XeNI/5Zo+nRAEmT8", "fileId": "9cEQF8XeNI/5Zo+nRAEmT8",
"instance": { "instance": {
"__id__": 51 "__id__": 49
}, },
"targetOverrides": [ "targetOverrides": [
{ {
"__id__": 61 "__id__": 59
}, },
{ {
"__id__": 64 "__id__": 62
} }
] ]
}, },
...@@ -674,22 +654,22 @@ ...@@ -674,22 +654,22 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 52 "__id__": 50
}, },
{ {
"__id__": 54 "__id__": 52
}, },
{ {
"__id__": 55 "__id__": 53
}, },
{ {
"__id__": 56 "__id__": 54
}, },
{ {
"__id__": 57 "__id__": 55
}, },
{ {
"__id__": 59 "__id__": 57
} }
], ],
"removedComponents": [] "removedComponents": []
...@@ -697,7 +677,7 @@ ...@@ -697,7 +677,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 53 "__id__": 51
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
...@@ -713,7 +693,7 @@ ...@@ -713,7 +693,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 53 "__id__": 51
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
...@@ -728,7 +708,7 @@ ...@@ -728,7 +708,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 53 "__id__": 51
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
...@@ -744,7 +724,7 @@ ...@@ -744,7 +724,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 53 "__id__": 51
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
...@@ -759,7 +739,7 @@ ...@@ -759,7 +739,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 58 "__id__": 56
}, },
"propertyPath": [ "propertyPath": [
"_carColor" "_carColor"
...@@ -775,7 +755,7 @@ ...@@ -775,7 +755,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 60 "__id__": 58
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
...@@ -797,10 +777,10 @@ ...@@ -797,10 +777,10 @@
"bodyMesh" "bodyMesh"
], ],
"target": { "target": {
"__id__": 62 "__id__": 60
}, },
"targetInfo": { "targetInfo": {
"__id__": 63 "__id__": 61
} }
}, },
{ {
...@@ -821,10 +801,10 @@ ...@@ -821,10 +801,10 @@
"top" "top"
], ],
"target": { "target": {
"__id__": 62 "__id__": 60
}, },
"targetInfo": { "targetInfo": {
"__id__": 65 "__id__": 63
} }
}, },
{ {
...@@ -843,13 +823,20 @@ ...@@ -843,13 +823,20 @@
}, },
"fileId": "42Z2ckGKdDSY/taLY7VCka", "fileId": "42Z2ckGKdDSY/taLY7VCka",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": [
{
"__id__": 65
},
{
"__id__": 68
}
],
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 49 "__id__": 47
}, },
{ {
"__id__": 34 "__id__": 32
}, },
{ {
"__id__": 17 "__id__": 17
...@@ -858,5 +845,67 @@ ...@@ -858,5 +845,67 @@
"__id__": 2 "__id__": 2
} }
] ]
},
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 17
},
"sourceInfo": {
"__id__": 66
},
"propertyPath": [
"bodyMesh"
],
"target": {
"__id__": 17
},
"targetInfo": {
"__id__": 67
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"6cFLC99U1Dl405ygHuNfbi"
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cf/T5kTMtMGbZ+TffqEVBX",
"4bF5OMT+RXw6cUdkZefPcR"
]
},
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 17
},
"sourceInfo": {
"__id__": 69
},
"propertyPath": [
"top"
],
"target": {
"__id__": 17
},
"targetInfo": {
"__id__": 70
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"6cFLC99U1Dl405ygHuNfbi"
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cf/T5kTMtMGbZ+TffqEVBX",
"fdy60pQTVT4YJabF3d41KH"
]
} }
] ]
\ No newline at end of file
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
"a6c4d563-2f30-4a18-9d91-80eff8639cac@7c4b3" "a6c4d563-2f30-4a18-9d91-80eff8639cac@7c4b3"
] ]
}, },
"promoteSingleRootNode": true, "promoteSingleRootNode": false,
"meshOptimize": { "meshOptimize": {
"enable": true, "enable": true,
"vertexCache": true, "vertexCache": true,
......
This diff is collapsed.
...@@ -23,45 +23,45 @@ const { ccclass, property, executeInEditMode } = _decorator; ...@@ -23,45 +23,45 @@ const { ccclass, property, executeInEditMode } = _decorator;
@executeInEditMode @executeInEditMode
export class CarCarColorsComponent extends Component { export class CarCarColorsComponent extends Component {
@property({ type: Enum(CarTypes) }) @property({ type: Enum(CarTypes) })
carType: CarTypes = CarTypes.CAR10 carType: CarTypes = CarTypes.CAR10;
@property({ type: Enum(CarColors) }) @property({ type: Enum(CarColors) })
get carColor() { get carColor() {
return this._carColor return this._carColor;
} }
set carColor(value) { set carColor(value) {
this._carColor = value this._carColor = value;
this.changeColor() this.changeColor();
} }
@property({ type: Enum(CarColors) }) @property({ type: Enum(CarColors) })
private _carColor: CarColors = CarColors.Purple private _carColor: CarColors = CarColors.Purple;
@property({ @property({
type: [Material] type: [Material]
}) })
colorMaterials: Array<Material> = [] colorMaterials: Array<Material> = [];
@property(MeshRenderer) bodyMesh: MeshRenderer = null @property(MeshRenderer) bodyMesh: MeshRenderer = null;
@property(MeshRenderer) top: MeshRenderer = null @property(MeshRenderer) top: MeshRenderer = null;
get sitNum() { get sitNum() {
return this.node.getChildByName("Seets").children.length; return this.node.getChildByName("Seets").children.length;
} }
halfLen: number = 2 halfLen: number = 2;
roleNum: number = 0 roleNum: number = 0;
isFull: boolean = false isFull: boolean = false;
tweenCount = 0 tweenCount = 0;
onLoad() { onLoad() {
this.changeColor() this.changeColor();
this.halfLen = this.getComponent(BoxCollider).size.z / 2; this.halfLen = this.getComponent(BoxCollider).size.z / 2;
this.roleNum = 0 this.roleNum = 0;
this.isFull = false this.isFull = false;
} }
changeColor() { changeColor() {
...@@ -72,12 +72,12 @@ export class CarCarColorsComponent extends Component { ...@@ -72,12 +72,12 @@ export class CarCarColorsComponent extends Component {
this.bodyMesh.setSharedMaterial(this.colorMaterials[this.carColor], 1); this.bodyMesh.setSharedMaterial(this.colorMaterials[this.carColor], 1);
this.top.setSharedMaterial(this.colorMaterials[this.carColor], this.top.materials.length - 1); this.top.setSharedMaterial(this.colorMaterials[this.carColor], this.top.materials.length - 1);
this.node.getChildByName("arrow").active = true this.node.getChildByName("arrow").active = true;
tween(this.node) tween(this.node)
.to(0.2, { scale: new Vec3(1.4, 1.4, 1.4) }) .to(0.2, { scale: new Vec3(1.4, 1.4, 1.4) })
.to(0.2, { scale: new Vec3(0.95, 0.95, 0.95) }) .to(0.2, { scale: new Vec3(0.95, 0.95, 0.95) })
.start() .start();
} }
addRole(role: Node): boolean { addRole(role: Node): boolean {
...@@ -87,38 +87,37 @@ export class CarCarColorsComponent extends Component { ...@@ -87,38 +87,37 @@ export class CarCarColorsComponent extends Component {
tween(role).to(0.2, { tween(role).to(0.2, {
position: new Vec3(0, 0, -0.1) position: new Vec3(0, 0, -0.1)
}).call(() => { }).call(() => {
this.tweenCount -= 1 this.tweenCount -= 1;
role.setScale(0.9, 0.9, 0.9) role.setScale(0.9, 0.9, 0.9);
role.setRotationFromEuler(0, 0, 0) role.setRotationFromEuler(0, 0, 0);
role.getComponent(RoleCarColorsComponent).playSit() role.getComponent(RoleCarColorsComponent).playSit();
if (this.tweenCount <= 0 && this.isFull) { if (this.tweenCount <= 0 && this.isFull) {
if (carPoint.getSiblingIndex() === 7) { if (carPoint.getSiblingIndex() === 7) {
carPoint.name = "lock" carPoint.name = "lock";
carPoint.children[0].children[0].active = false carPoint.children[0].children[0].active = false;
carPoint.children[0].children[1].active = true carPoint.children[0].children[1].active = true;
} else { } else {
carPoint.name = "empty" carPoint.name = "empty";
} }
this.carOutTween(carPoint) this.carOutTween(carPoint);
} }
}) }).start();
.start()
this.tweenCount += 1 this.tweenCount += 1;
this.roleNum += 1 this.roleNum += 1;
this.isFull = this.roleNum >= this.sitNum; this.isFull = this.roleNum >= this.sitNum;
return this.isFull return this.isFull;
} }
carOut() { carOut() {
this.node.getChildByName("Seets").children.forEach(seat => { this.node.getChildByName("Seets").children.forEach(seat => {
if (seat.children.length === 0) return if (seat.children.length === 0) return;
const roleCom = seat.children[0].getComponent(RoleCarColorsComponent) const roleCom = seat.children[0].getComponent(RoleCarColorsComponent);
CarColorsGlobalInstance.instance.roleSysterm.clearOne(roleCom) CarColorsGlobalInstance.instance.roleSysterm.clearOne(roleCom);
}) });
CarColorsGlobalInstance.instance.carSysterm.removeCar(this.node) CarColorsGlobalInstance.instance.carSysterm.removeCar(this.node);
this.node.removeFromParent() this.node.removeFromParent();
this.node.destroy() this.node.destroy();
// console.log("carOut:", find("Scene/Levels").children.length, find("Scene/Levels").children[0].children.length, find("Scene/Roles").children.length) // console.log("carOut:", find("Scene/Levels").children.length, find("Scene/Levels").children[0].children.length, find("Scene/Roles").children.length)
// 判定胜利 // 判定胜利
...@@ -132,25 +131,26 @@ export class CarCarColorsComponent extends Component { ...@@ -132,25 +131,26 @@ export class CarCarColorsComponent extends Component {
// 车离开 // 车离开
carOutTween(target: Node) { carOutTween(target: Node) {
tween(this.node).to(0.2, { tween(this.node)
worldPosition: target.getWorldPosition() .to(0.2, {
}) worldPosition: target.getWorldPosition()
})
.call(() => { .call(() => {
const carforward = this.node.forward.clone() const carforward = this.node.forward.clone();
tween(carforward).to(0.1, { x: -1, y: 0, z: 0 }, { tween(carforward).to(0.1, { x: -1, y: 0, z: 0 }, {
onUpdate: () => { onUpdate: () => {
this.node.forward = carforward this.node.forward = carforward;
} }
}).start() }).start();
}) })
.delay(0.1) .delay(0.1)
.to(0.2, { .to(0.2, {
worldPosition: find("Scene/physicRoodTop/rightPoint").getWorldPosition() worldPosition: find("Scene/physicRoodTop/rightPoint").getWorldPosition(),
}) })
.call(() => { .call(() => {
this.carOut() this.carOut();
}) })
.start() .start();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment