feat: update game environments logic

main
tiendat3699 2024-03-08 18:07:41 +07:00
parent 712cb8aa30
commit d94082f019
23 changed files with 2180 additions and 1586 deletions

View File

@ -105,7 +105,7 @@
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -25,
"value": -30,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,

View File

@ -21,10 +21,16 @@
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 62
"__id__": 66
},
"_lpos": {
"__type__": "cc.Vec3",
@ -41,8 +47,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 80,
"y": 80,
"z": 1
},
"_mobility": 0,
@ -56,7 +62,7 @@
"_id": ""
},
{
"__type__": "cc.ParticleSystem",
"__type__": "cc.UIMeshRenderer",
"_name": "",
"_objFlags": 0,
"node": {
@ -66,68 +72,112 @@
"__prefab": {
"__id__": 3
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c56iU+S8BGd6QIOPoubj80"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "66n5bTtqhG8Y2meMRtYyMk"
},
{
"__type__": "cc.ParticleSystem",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_materials": [
{
"__uuid__": "ea7478b0-408d-4052-b703-f0d2355e095f",
"__uuid__": "601118ed-3a55-4d36-9364-79083615a5d6",
"__expectedType__": "cc.Material"
}
],
"_visFlags": 0,
"startColor": {
"__id__": 4
"__id__": 8
},
"scaleSpace": 1,
"startSize3D": true,
"startSizeX": {
"__id__": 10
"__id__": 14
},
"startSize": {
"__id__": 10
"__id__": 14
},
"startSizeY": {
"__id__": 11
"__id__": 15
},
"startSizeZ": {
"__id__": 12
"__id__": 16
},
"startSpeed": {
"__id__": 13
"__id__": 17
},
"startRotation3D": true,
"startRotationX": {
"__id__": 14
"__id__": 18
},
"startRotationY": {
"__id__": 15
"__id__": 19
},
"startRotationZ": {
"__id__": 16
"__id__": 20
},
"startRotation": {
"__id__": 16
"__id__": 20
},
"startDelay": {
"__id__": 17
"__id__": 21
},
"startLifetime": {
"__id__": 18
"__id__": 22
},
"duration": 1.5,
"loop": true,
"simulationSpeed": 1,
"playOnAwake": true,
"gravityModifier": {
"__id__": 19
"__id__": 23
},
"rateOverTime": {
"__id__": 20
"__id__": 24
},
"rateOverDistance": {
"__id__": 21
"__id__": 25
},
"bursts": [
{
"__id__": 22
"__id__": 26
}
],
"_renderCulling": false,
@ -138,37 +188,37 @@
"_dataCulling": false,
"enableCulling": false,
"_colorOverLifetimeModule": {
"__id__": 24
},
"_shapeModule": {
"__id__": 26
},
"_sizeOvertimeModule": {
"__id__": 28
},
"_shapeModule": {
"__id__": 30
},
"_sizeOvertimeModule": {
"__id__": 32
},
"_velocityOvertimeModule": {
"__id__": 33
"__id__": 37
},
"_forceOvertimeModule": {
"__id__": 38
},
"_limitVelocityOvertimeModule": {
"__id__": 42
},
"_rotationOvertimeModule": {
"__id__": 47
"_limitVelocityOvertimeModule": {
"__id__": 46
},
"_textureAnimationModule": {
"_rotationOvertimeModule": {
"__id__": 51
},
"_noiseModule": {
"_textureAnimationModule": {
"__id__": 55
},
"_noiseModule": {
"__id__": 59
},
"_trailModule": {
"__id__": 56
"__id__": 60
},
"renderer": {
"__id__": 61
"__id__": 65
},
"_prewarm": false,
"_capacity": 100,
@ -183,25 +233,25 @@
"__type__": "cc.GradientRange",
"_mode": 4,
"gradient": {
"__id__": 5
"__id__": 9
}
},
{
"__type__": "cc.Gradient",
"colorKeys": [
{
"__id__": 6
"__id__": 10
},
{
"__id__": 7
"__id__": 11
},
{
"__id__": 8
"__id__": 12
}
],
"alphaKeys": [
{
"__id__": 9
"__id__": 13
}
],
"mode": 0
@ -275,21 +325,21 @@
"__type__": "cc.CurveRange",
"mode": 3,
"constantMin": 0,
"constantMax": 0.015230877516916316,
"constantMax": 0.8726646259971648,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 3,
"constantMin": 0,
"constantMax": 0.015230877516916316,
"constantMax": 0.8726646259971648,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 3,
"constantMin": 0,
"constantMax": 0.0003046123143505703,
"constantMax": 6.283185307179586,
"multiplier": 1
},
{
@ -301,7 +351,7 @@
{
"__type__": "cc.CurveRange",
"mode": 3,
"constantMin": 0.3,
"constantMin": 0.5,
"constantMax": 1.5,
"multiplier": 1
},
@ -329,7 +379,7 @@
"_repeatCount": 1,
"repeatInterval": 0.01,
"count": {
"__id__": 23
"__id__": 27
}
},
{
@ -342,7 +392,7 @@
"__type__": "cc.ColorOvertimeModule",
"_enable": false,
"color": {
"__id__": 25
"__id__": 29
}
},
{
@ -371,7 +421,7 @@
"arcMode": 0,
"arcSpread": 0,
"arcSpeed": {
"__id__": 27
"__id__": 31
},
"length": 5,
"boxThickness": {
@ -412,16 +462,16 @@
"_enable": false,
"separateAxes": false,
"size": {
"__id__": 29
"__id__": 33
},
"x": {
"__id__": 30
"__id__": 34
},
"y": {
"__id__": 31
"__id__": 35
},
"z": {
"__id__": 32
"__id__": 36
}
},
{
@ -450,18 +500,18 @@
},
{
"__type__": "cc.VelocityOvertimeModule",
"_enable": false,
"_enable": true,
"x": {
"__id__": 34
"__id__": 38
},
"y": {
"__id__": 35
"__id__": 39
},
"z": {
"__id__": 36
"__id__": 40
},
"speedModifier": {
"__id__": 37
"__id__": 41
},
"space": 1
},
@ -493,13 +543,13 @@
"__type__": "cc.ForceOvertimeModule",
"_enable": false,
"x": {
"__id__": 39
"__id__": 43
},
"y": {
"__id__": 40
"__id__": 44
},
"z": {
"__id__": 41
"__id__": 45
},
"space": 1
},
@ -525,16 +575,16 @@
"__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false,
"limitX": {
"__id__": 43
"__id__": 47
},
"limitY": {
"__id__": 44
"__id__": 48
},
"limitZ": {
"__id__": 45
"__id__": 49
},
"limit": {
"__id__": 46
"__id__": 50
},
"dampen": 3,
"separateAxes": false,
@ -566,34 +616,37 @@
},
{
"__type__": "cc.RotationOvertimeModule",
"_enable": false,
"_separateAxes": false,
"_enable": true,
"_separateAxes": true,
"x": {
"__id__": 48
"__id__": 52
},
"y": {
"__id__": 49
"__id__": 53
},
"z": {
"__id__": 50
"__id__": 54
}
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"mode": 3,
"constantMin": 0.7853981633974483,
"constantMax": 6.283185307179586,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"mode": 3,
"constantMin": 0.7853981633974483,
"constantMax": 6.283185307179586,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"mode": 3,
"constantMin": 0.7853981633974483,
"constantMax": 6.283185307179586,
"multiplier": 1
},
{
@ -606,10 +659,10 @@
"_mode": 0,
"animation": 0,
"frameOverTime": {
"__id__": 52
"__id__": 56
},
"startFrame": {
"__id__": 54
"__id__": 58
},
"cycleCount": 0,
"_flipU": 0,
@ -622,7 +675,7 @@
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 53
"__id__": 57
},
"multiplier": 1
},
@ -689,25 +742,25 @@
"_enable": false,
"mode": 0,
"lifeTime": {
"__id__": 57
"__id__": 61
},
"_minParticleDistance": 0.1,
"existWithParticles": true,
"textureMode": 0,
"widthFromParticle": true,
"widthRatio": {
"__id__": 58
"__id__": 62
},
"colorFromParticle": false,
"colorOverTrail": {
"__id__": 59
"__id__": 63
},
"colorOvertime": {
"__id__": 60
"__id__": 64
},
"_space": 0,
"_particleSystem": {
"__id__": 2
"__id__": 6
}
},
{
@ -751,14 +804,11 @@
"_lengthScale": 1,
"_mesh": null,
"_cpuMaterial": {
"__uuid__": "ea7478b0-408d-4052-b703-f0d2355e095f",
"__uuid__": "601118ed-3a55-4d36-9364-79083615a5d6",
"__expectedType__": "cc.Material"
},
"_gpuMaterial": null,
"_mainTexture": {
"__uuid__": "b5b27ab1-e740-4398-b407-848fc2b2c897@6c48a",
"__expectedType__": "cc.Texture2D"
},
"_mainTexture": null,
"_useGPU": false,
"_alignSpace": 2
},

View File

@ -21,10 +21,16 @@
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 61
"__id__": 65
},
"_lpos": {
"__type__": "cc.Vec3",
@ -56,7 +62,7 @@
"_id": ""
},
{
"__type__": "cc.ParticleSystem",
"__type__": "cc.UIMeshRenderer",
"_name": "",
"_objFlags": 0,
"node": {
@ -66,6 +72,50 @@
"__prefab": {
"__id__": 3
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d7vlREn21O3pz+rhwBsmvE"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1,
"height": 1
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "14sgflQQxL3L23o+Yc4Phx"
},
{
"__type__": "cc.ParticleSystem",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_materials": [
{
"__uuid__": "9aa5d037-ec4c-4f5a-9513-4a423d576110",
@ -74,60 +124,60 @@
],
"_visFlags": 0,
"startColor": {
"__id__": 4
"__id__": 8
},
"scaleSpace": 1,
"startSize3D": false,
"startSizeX": {
"__id__": 5
"__id__": 9
},
"startSize": {
"__id__": 5
"__id__": 9
},
"startSizeY": {
"__id__": 6
"__id__": 10
},
"startSizeZ": {
"__id__": 7
"__id__": 11
},
"startSpeed": {
"__id__": 8
"__id__": 12
},
"startRotation3D": false,
"startRotationX": {
"__id__": 9
"__id__": 13
},
"startRotationY": {
"__id__": 10
"__id__": 14
},
"startRotationZ": {
"__id__": 11
"__id__": 15
},
"startRotation": {
"__id__": 11
"__id__": 15
},
"startDelay": {
"__id__": 12
"__id__": 16
},
"startLifetime": {
"__id__": 13
"__id__": 17
},
"duration": 1,
"loop": false,
"simulationSpeed": 1,
"playOnAwake": false,
"gravityModifier": {
"__id__": 14
"__id__": 18
},
"rateOverTime": {
"__id__": 15
"__id__": 19
},
"rateOverDistance": {
"__id__": 16
"__id__": 20
},
"bursts": [
{
"__id__": 17
"__id__": 21
}
],
"_renderCulling": false,
@ -138,37 +188,37 @@
"_dataCulling": false,
"enableCulling": false,
"_colorOverLifetimeModule": {
"__id__": 19
"__id__": 23
},
"_shapeModule": {
"__id__": 24
"__id__": 28
},
"_sizeOvertimeModule": {
"__id__": 26
"__id__": 30
},
"_velocityOvertimeModule": {
"__id__": 32
"__id__": 36
},
"_forceOvertimeModule": {
"__id__": 37
},
"_limitVelocityOvertimeModule": {
"__id__": 41
},
"_rotationOvertimeModule": {
"__id__": 46
"_limitVelocityOvertimeModule": {
"__id__": 45
},
"_textureAnimationModule": {
"_rotationOvertimeModule": {
"__id__": 50
},
"_noiseModule": {
"_textureAnimationModule": {
"__id__": 54
},
"_noiseModule": {
"__id__": 58
},
"_trailModule": {
"__id__": 55
"__id__": 59
},
"renderer": {
"__id__": 60
"__id__": 64
},
"_prewarm": false,
"_capacity": 100,
@ -268,7 +318,7 @@
"_repeatCount": 1,
"repeatInterval": 0.01,
"count": {
"__id__": 18
"__id__": 22
}
},
{
@ -281,14 +331,14 @@
"__type__": "cc.ColorOvertimeModule",
"_enable": false,
"color": {
"__id__": 20
"__id__": 24
}
},
{
"__type__": "cc.GradientRange",
"_mode": 1,
"gradient": {
"__id__": 21
"__id__": 25
}
},
{
@ -296,10 +346,10 @@
"colorKeys": [],
"alphaKeys": [
{
"__id__": 22
"__id__": 26
},
{
"__id__": 23
"__id__": 27
}
],
"mode": 0
@ -329,7 +379,7 @@
"arcMode": 0,
"arcSpread": 0,
"arcSpeed": {
"__id__": 25
"__id__": 29
},
"length": 5,
"boxThickness": {
@ -370,23 +420,23 @@
"_enable": true,
"separateAxes": false,
"size": {
"__id__": 27
"__id__": 31
},
"x": {
"__id__": 29
"__id__": 33
},
"y": {
"__id__": 30
"__id__": 34
},
"z": {
"__id__": 31
"__id__": 35
}
},
{
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 28
"__id__": 32
},
"multiplier": 1
},
@ -447,16 +497,16 @@
"__type__": "cc.VelocityOvertimeModule",
"_enable": false,
"x": {
"__id__": 33
"__id__": 37
},
"y": {
"__id__": 34
"__id__": 38
},
"z": {
"__id__": 35
"__id__": 39
},
"speedModifier": {
"__id__": 36
"__id__": 40
},
"space": 1
},
@ -488,13 +538,13 @@
"__type__": "cc.ForceOvertimeModule",
"_enable": false,
"x": {
"__id__": 38
"__id__": 42
},
"y": {
"__id__": 39
"__id__": 43
},
"z": {
"__id__": 40
"__id__": 44
},
"space": 1
},
@ -520,16 +570,16 @@
"__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false,
"limitX": {
"__id__": 42
"__id__": 46
},
"limitY": {
"__id__": 43
"__id__": 47
},
"limitZ": {
"__id__": 44
"__id__": 48
},
"limit": {
"__id__": 45
"__id__": 49
},
"dampen": 3,
"separateAxes": false,
@ -564,13 +614,13 @@
"_enable": false,
"_separateAxes": false,
"x": {
"__id__": 47
"__id__": 51
},
"y": {
"__id__": 48
"__id__": 52
},
"z": {
"__id__": 49
"__id__": 53
}
},
{
@ -601,10 +651,10 @@
"_mode": 0,
"animation": 0,
"frameOverTime": {
"__id__": 51
"__id__": 55
},
"startFrame": {
"__id__": 53
"__id__": 57
},
"cycleCount": 0,
"_flipU": 0,
@ -617,7 +667,7 @@
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 52
"__id__": 56
},
"multiplier": 1
},
@ -684,25 +734,25 @@
"_enable": false,
"mode": 0,
"lifeTime": {
"__id__": 56
"__id__": 60
},
"_minParticleDistance": 0.1,
"existWithParticles": true,
"textureMode": 0,
"widthFromParticle": true,
"widthRatio": {
"__id__": 57
"__id__": 61
},
"colorFromParticle": false,
"colorOverTrail": {
"__id__": 58
"__id__": 62
},
"colorOvertime": {
"__id__": 59
"__id__": 63
},
"_space": 0,
"_particleSystem": {
"__id__": 2
"__id__": 6
}
},
{
@ -741,7 +791,7 @@
},
{
"__type__": "cc.ParticleSystemRenderer",
"_renderMode": 0,
"_renderMode": 3,
"_velocityScale": 1,
"_lengthScale": 1,
"_mesh": null,

View File

@ -0,0 +1,240 @@
[
{
"__type__": "cc.Prefab",
"_name": "Label",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
},
{
"__id__": 10
}
],
"_prefab": {
"__id__": 12
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_contentSize": {
"__type__": "cc.Size",
"width": 71.85,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "68yf2T92dMoZbjIprM+tkX"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "+10",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 40,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5eG2p/+HVMWaHEoawMVCyH"
},
{
"__type__": "7ea0aCduT5OYaPoiJan0I8j",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_lable": {
"__id__": 4
},
"_moveSpeed": 50,
"_animationCurve": {
"__id__": 8
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b66sHSLUFGkpJOa7gt5PpJ"
},
{
"__type__": "cc.AnimationCurve",
"_curve": {
"__id__": 9
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 2,
"postExtrapolation": 1
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c5nnXEe4VJB4s9qYdfaoP/"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1fuwMYcsRH06ykaXQ3fPi3",
"instance": null,
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.43",
"importer": "prefab",
"imported": true,
"uuid": "fadb66db-6899-45d0-a28c-4e3709c86180",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "Label"
}
}

View File

@ -94,7 +94,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -25,
"y": -30,
"z": 0
},
"_lrot": {
@ -133,8 +133,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 20,
"height": 50
"width": 30,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -169,7 +169,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__uuid__": "87757196-d6ec-4542-a8e8-11ae43be20bf@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
@ -217,8 +217,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 20,
"height": 50
"width": 30,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -243,7 +243,7 @@
"__id__": 11
},
"tag": 0,
"_group": 16,
"_group": 2,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
@ -255,8 +255,8 @@
},
"_size": {
"__type__": "cc.Size",
"width": 20,
"height": 50
"width": 30,
"height": 60
},
"_id": ""
},
@ -278,7 +278,7 @@
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_group": 16,
"_group": 2,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
@ -318,7 +318,7 @@
"__id__": 16
},
"_score": 10,
"_flySpeed": 500,
"_flySpeed": 1000,
"_id": ""
},
{

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
import { _decorator, CCInteger, Collider2D, Component, Contact2DType, EventHandler, tween, Vec2 } from 'cc';
import { Ball } from '../Gameplay/Ball';
import Utilities from '../Utilities/Utilities';
const { ccclass, property } = _decorator;
@ccclass('Cannon')
export class Cannon extends Component {
@property({ type: Collider2D, visible: true })
private _collider: Collider2D;
@property({ type: CCInteger, visible: true })
private _force = 30;
@property({ type: EventHandler, visible: true })
private onDone: EventHandler[] = [];
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
private async onBeginContact(seft: Collider2D, other: Collider2D) {
const ball = other.getComponent(Ball);
this._collider.enabled = false;
if (ball) {
ball.setActiveRigi(false);
tween(ball.node).to(0.1, { worldPosition: this.node.worldPosition }).start();
await Utilities.delay(1000);
ball.setActiveRigi(true);
ball.throwBall(new Vec2(0, this._force));
await Utilities.delay(500);
this._collider.enabled = true;
EventHandler.emitEvents(this.onDone, ball);
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bbe59da3-d216-484e-8c9e-de512aca245a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,51 @@
import { _decorator, CCFloat, Component, geometry, Label, tween, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('FloatingText')
export class FloatingText extends Component {
@property({ type: Label, visible: true })
private _lable: Label;
@property({ type: CCFloat, visible: true })
private _moveSpeed = 1;
@property({ type: geometry.AnimationCurve, visible: true })
private _animationCurve: geometry.AnimationCurve = new geometry.AnimationCurve();
private readonly _scaleUpDuration = 0.2;
private readonly _scaleDownDuration = 0.2;
private _moveDuration = 0;
public show(text: string, position: Vec3, scale = 1, duration = 1) {
if (duration < this._scaleUpDuration + this._scaleDownDuration) {
console.warn(
`show duration time of floating text must be greater than ${this._scaleUpDuration + this._scaleDownDuration}`,
);
duration = this._scaleUpDuration + this._scaleDownDuration + 0.5;
}
this._moveDuration = duration - (this._scaleUpDuration + this._scaleDownDuration);
this.node.setWorldPosition(position);
this.node.setScale(Vec3.ZERO);
this._lable.string = text;
tween(this.node)
.to(this._scaleUpDuration, { scale: new Vec3(scale, scale, 1) }, { easing: 'backOut' })
.by(
this._moveDuration,
{
worldPosition: new Vec3(0, 1 * this._moveSpeed, 10),
},
{
easing: (k) => {
return this._animationCurve.evaluate(k);
},
},
)
.to(
this._scaleDownDuration,
{
scale: Vec3.ZERO,
},
{ easing: 'backIn' },
)
.sequence()
.start();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7ea0a09d-b93e-4e61-a3e8-8896a7d08f23",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,26 @@
import { _decorator, Component, Node } from 'cc';
import { EventManger } from '../Manager/EventManger';
import GameEvent from '../Events/GameEvent';
const { ccclass, property } = _decorator;
@ccclass('Gate')
export class Gate extends Component {
@property({ type: Node, visible: true })
private _gate: Node;
protected onLoad(): void {
EventManger.instance.on(GameEvent.BallOut, this.reset, this);
}
private reset() {
this.open();
}
public close() {
this._gate.active = true;
}
public open() {
this._gate.active = false;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "2162ade9-5adb-492a-8bef-92f81aef908c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -1,6 +1,8 @@
import { _decorator, CCInteger, Collider2D, Component, Contact2DType, Node } from 'cc';
import { _decorator, CCInteger, Collider2D, Component, Contact2DType, Node, RigidBody2D } from 'cc';
import { GameManager } from '../Manager/GameManager';
import ObjectPool from '../Pool/ObjectPool';
import Utilities from '../Utilities/Utilities';
import { Ball } from '../Gameplay/Ball';
const { ccclass, property, float } = _decorator;
@ccclass('Goal')
@ -14,8 +16,13 @@ export class Goal extends Component {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
}
private onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
ObjectPool.release(otherCollider.node);
GameManager.instance.goal(this._score);
private async onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
const ball = otherCollider.getComponent(Ball);
if (ball) {
GameManager.instance.goal(this._score, otherCollider.node.getWorldPosition());
ball.setActiveRigi(false);
await Utilities.delay(1000);
ObjectPool.release(otherCollider.node);
}
}
}

View File

@ -7,6 +7,8 @@ import {
Color,
Component,
Contact2DType,
math,
RigidBody2D,
Sprite,
Vec3,
} from 'cc';
@ -28,9 +30,8 @@ export class ScoreObject extends Component implements IPoolable {
private _spawnAnimation: Animation;
@property({ type: CCInteger, visible: true })
private _score: number;
@property({ type: CCFloat, visible: true })
private _flySpeed: number;
private _flySpeed: number;
private _flyDirection: Vec3;
private _targetColor: Color;
private _originColor: Color;
@ -44,14 +45,17 @@ export class ScoreObject extends Component implements IPoolable {
protected update(dt: number): void {
if (this._hitted) {
const pos = new Vec3();
Vec3.multiplyScalar(pos, this._flyDirection, this._flySpeed * dt);
const flySpeed = math.clamp(this._flySpeed * 10, 500, 1000);
Vec3.multiplyScalar(pos, this._flyDirection, flySpeed * dt);
this.node.worldPosition = this.node.getWorldPosition().add(pos);
const scale = new Vec3();
Vec3.multiplyScalar(scale, Vec3.ONE.clone(), 1 * dt);
Vec3.multiplyScalar(scale, Vec3.ONE.clone(), 1.5 * dt);
this.node.scale = this.node.getScale().add(scale);
this.node.angle += 800 * dt;
const rotSpeed = math.clamp(this._flySpeed * 50, 500, 2000);
this.node.angle += rotSpeed * dt;
this._sprite.color = this._sprite.color.clone().lerp(this._targetColor, 1 * dt);
if (this._sprite.color.a == 0) {
@ -71,14 +75,16 @@ export class ScoreObject extends Component implements IPoolable {
this._hitted = true;
this._targetColor = this._sprite.color.clone();
this._targetColor.a = 0;
this._flySpeed = otherCollider.getComponent(RigidBody2D).linearVelocity.length();
this.node.setSiblingIndex(this.node.parent.children.length - 1);
if (this._score > 0) {
GameManager.instance.destroyEnviromentsObject(this._score);
GameManager.instance.destroyEnviromentsObject(this._score, this.node.getWorldPosition());
}
}
public reuse() {
public async reuse() {
this._spawnAnimation.play();
await Utilities.delay(this._spawnAnimation.defaultClip.duration * 1000);
this._collider.enabled = true;
}

View File

@ -3,20 +3,23 @@ import GameState from '../Enum/GameState';
import ScoreType from '../Enum/ScoreType';
enum GameEvent {
GameStateChange,
Score,
BallOut,
GameStateChange,
ScoreObjectRelease,
}
export interface GameEventCallbackMap {
[GameEvent.GameStateChange]: (state: GameState) => void;
[GameEvent.Score]: (type: ScoreType, score: number) => void;
[GameEvent.BallOut]: () => void;
[GameEvent.GameStateChange]: (state: GameState) => void;
[GameEvent.ScoreObjectRelease]: (obj: Node) => void;
}
export interface GameEventArgMap {
[GameEvent.GameStateChange]: GameState;
[GameEvent.Score]: [ScoreType, number];
[GameEvent.BallOut]: null;
[GameEvent.GameStateChange]: GameState;
[GameEvent.ScoreObjectRelease]: Node;
}

View File

@ -112,7 +112,6 @@ export class Ball extends Component implements IPoolable {
}
private onEndContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
// console.log(otherCollider.tag, otherCollider.node.name);
this._hitted = false;
}
@ -135,9 +134,18 @@ export class Ball extends Component implements IPoolable {
this._jumpDuration = this._rigidbody.linearVelocity.length() * 0.05;
}
public setActiveRigi(value: boolean) {
this._rigidbody.enabled = value;
if (!value) {
this._rigidbody.linearVelocity = Vec2.ZERO.clone();
this._rigidbody.angularVelocity = 0;
}
}
reuse() {
this._isJumping = false;
this._hitted = false;
this._rigidbody.enabled = true;
}
unuse() {

View File

@ -1,4 +1,4 @@
import { _decorator, Component, Prefab, Node, Vec2, Vec3, randomRangeInt, CCInteger, Input } from 'cc';
import { _decorator, Component, Node, Prefab, Vec2, Vec3, randomRangeInt, CCInteger } from 'cc';
import ObjectPool from '../Pool/ObjectPool';
import { Ball } from '../Gameplay/Ball';
import Utilities from '../Utilities/Utilities';
@ -6,6 +6,7 @@ import GameState from '../Enum/GameState';
import { EventManger } from './EventManger';
import GameEvent from '../Events/GameEvent';
import ScoreType from '../Enum/ScoreType';
import { FloatingText } from '../Environments/FloatingText';
const { ccclass, property } = _decorator;
@ccclass('GameManager')
@ -18,13 +19,17 @@ export class GameManager extends Component {
@property({ type: Prefab, visible: true })
private _ballPrefab: Prefab;
@property({ type: Prefab, visible: true })
private _floatingScoreText: Prefab;
@property({ type: Node, visible: true })
private _floatingTextContainer: Node;
@property({ visible: true })
private _ballSpawnPosition: Vec3;
@property({ type: CCInteger, visible: true })
private _balls = 3;
private _ballPool: ObjectPool;
private _FloatingScorePool: ObjectPool;
private _gameState = GameState.Init;
public highestStreak: number;
@ -33,6 +38,7 @@ export class GameManager extends Component {
protected onLoad(): void {
GameManager._instance = this;
this._ballPool = new ObjectPool(this._ballPrefab, 10, true, Ball);
this._FloatingScorePool = new ObjectPool(this._floatingScoreText, 10, true);
}
protected start() {
@ -44,9 +50,10 @@ export class GameManager extends Component {
EventManger.instance.emit(GameEvent.GameStateChange, this._gameState);
}
private addScore(score: number, type: ScoreType) {
private addScore(score: number, type: ScoreType, position: Vec3) {
this._score += score;
console.log('score:' + this._score);
const floatingScore = this._FloatingScorePool.get(this._floatingTextContainer, FloatingText);
floatingScore.show(`+${score}`, position, score >= 100 ? 1.5 : 1, score >= 100 ? 1 : 0.7);
EventManger.instance.emit(GameEvent.Score, [type, this._score]);
}
@ -64,6 +71,7 @@ export class GameManager extends Component {
public async ballOut() {
this._balls--;
EventManger.instance.emit(GameEvent.BallOut, null);
if (this._balls === 0) {
this._ballPool.clear();
return;
@ -72,14 +80,14 @@ export class GameManager extends Component {
this.spawnBall();
}
public async goal(bonusScore: number) {
this.addScore(bonusScore, ScoreType.Goal);
public async goal(bonusScore: number, position: Vec3) {
this.addScore(bonusScore, ScoreType.Goal, position);
await Utilities.delay(1000);
this.spawnBall();
}
public destroyEnviromentsObject(bonusScore: number) {
this.addScore(bonusScore, ScoreType.DestroyObject);
public destroyEnviromentsObject(bonusScore: number, position: Vec3) {
this.addScore(bonusScore, ScoreType.DestroyObject, position);
}
public onRevive() {

View File

@ -14,9 +14,9 @@ export class SpawnObjectManager extends Component {
}
//#endregion
@property({ type: [Prefab], visible: true })
@property({ type: Prefab, visible: true })
private _objects: Prefab[] = [];
@property({ type: [Node], visible: true })
@property({ type: Node, visible: true })
private _spawnPoints: Node[] = [];
@property({ type: CCFloat, visible: true, range: [1, 10], slide: true })
private _spawnTime;

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "87757196-d6ec-4542-a8e8-11ae43be20bf",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "87757196-d6ec-4542-a8e8-11ae43be20bf@6c48a",
"displayName": "day-la-lon-nc-ngot",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "87757196-d6ec-4542-a8e8-11ae43be20bf",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "87757196-d6ec-4542-a8e8-11ae43be20bf@f9941",
"displayName": "day-la-lon-nc-ngot",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 0,
"trimX": 285,
"trimY": 72,
"width": 431,
"height": 856,
"rawWidth": 1000,
"rawHeight": 1000,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-215.5,
-428,
0,
215.5,
-428,
0,
-215.5,
428,
0,
215.5,
428,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
285,
928,
716,
928,
285,
72,
716,
72
],
"nuv": [
0.285,
0.072,
0.716,
0.072,
0.285,
0.928,
0.716,
0.928
],
"minPos": [
-215.5,
-428,
0
],
"maxPos": [
215.5,
428,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "87757196-d6ec-4542-a8e8-11ae43be20bf@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"redirect": "87757196-d6ec-4542-a8e8-11ae43be20bf@f9941"
}
}

View File

@ -74,10 +74,10 @@
"_value": false
},
"geometry-renderer": {
"_value": false
"_value": true
},
"debug-renderer": {
"_value": false
"_value": true
},
"particle-2d": {
"_value": true
@ -128,7 +128,9 @@
"animation",
"audio",
"base",
"debug-renderer",
"dragon-bones",
"geometry-renderer",
"gfx-webgl",
"gfx-webgl2",
"intersection-2d",

View File

@ -33,9 +33,9 @@
],
"collisionMatrix": {
"0": 21,
"1": 12,
"1": 4,
"2": 23,
"3": 18,
"3": 16,
"4": 29
}
},
@ -47,8 +47,13 @@
"id": 0,
"name": "default",
"value": 0
},
{
"id": 3,
"name": "1",
"value": 1
}
],
"increaseId": 2
"increaseId": 3
}
}