Commit 2972f601 authored by haiyoucuv's avatar haiyoucuv

init

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