feat: game environment logic

main
tiendat3699 2024-03-07 18:15:08 +07:00
parent 136a898942
commit a5995a7942
35 changed files with 2368 additions and 643 deletions

View File

@ -1,224 +0,0 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "goal",
"_objFlags": 0,
"__editorExtras__": {
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 60,
"speed": 1,
"wrapMode": 1,
"enableTrsBlending": false,
"_duration": 0.25,
"_hash": 500763545,
"_tracks": [
{
"__id__": 1
}
],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": []
},
{
"__type__": "cc.animation.VectorTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channels": [
{
"__id__": 4
},
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 10
}
],
"_nComponents": 3
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"position"
]
},
{
"__type__": "cc.animation.HierarchyPath",
"path": "goal"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.03333333333333333,
0.08333333333333333,
0.15,
0.2,
0.25
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -10,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -2,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 10,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": -3,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 7
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 9
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 11
}
},
{
"__type__": "cc.RealCurve",
"_times": [],
"_values": [],
"preExtrapolation": 1,
"postExtrapolation": 1
}
]

View File

@ -1,13 +0,0 @@
{
"ver": "2.0.3",
"importer": "animation-clip",
"imported": true,
"uuid": "e0cda13a-c026-4d67-82c4-54acfe00f72d",
"files": [
".cconb"
],
"subMetas": {},
"userData": {
"name": "goal"
}
}

View File

@ -0,0 +1,40 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"_native": "",
"_effectAsset": {
"__uuid__": "d1346436-ac96-4271-b863-1f4fdead95b0",
"__expectedType__": "cc.EffectAsset"
},
"_techIdx": 0,
"_defines": [
{}
],
"_states": [
{
"rasterizerState": {},
"depthStencilState": {},
"blendState": {
"targets": [
{}
]
}
}
],
"_props": [
{
"mainTexture": {
"__uuid__": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@6c48a",
"__expectedType__": "cc.Texture2D"
},
"tintColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
}
]
}

View File

@ -0,0 +1,11 @@
{
"ver": "1.0.20",
"importer": "material",
"imported": true,
"uuid": "9aa5d037-ec4c-4f5a-9513-4a423d576110",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@ -24,23 +24,20 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 61 "__id__": 71
}, },
{ {
"__id__": 63 "__id__": 73
}, },
{ {
"__id__": 65 "__id__": 75
}, },
{ {
"__id__": 67 "__id__": 77
},
{
"__id__": 69
} }
], ],
"_prefab": { "_prefab": {
"__id__": 71 "__id__": 81
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -73,20 +70,73 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Trail", "_name": "Graphics",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [
{
"__id__": 3
},
{
"__id__": 62
}
],
"_active": true,
"_components": [
{
"__id__": 68
}
],
"_prefab": {
"__id__": 70
},
"_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.Node",
"_name": "Trail",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 3 "__id__": 4
} }
], ],
"_prefab": { "_prefab": {
"__id__": 60 "__id__": 61
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -122,11 +172,11 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 2 "__id__": 3
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 4 "__id__": 5
}, },
"_materials": [ "_materials": [
{ {
@ -137,57 +187,57 @@
], ],
"_visFlags": 0, "_visFlags": 0,
"startColor": { "startColor": {
"__id__": 5 "__id__": 6
}, },
"scaleSpace": 1, "scaleSpace": 1,
"startSize3D": false, "startSize3D": false,
"startSizeX": { "startSizeX": {
"__id__": 6
},
"startSize": {
"__id__": 6
},
"startSizeY": {
"__id__": 7 "__id__": 7
}, },
"startSizeZ": { "startSize": {
"__id__": 7
},
"startSizeY": {
"__id__": 8 "__id__": 8
}, },
"startSpeed": { "startSizeZ": {
"__id__": 9 "__id__": 9
}, },
"startSpeed": {
"__id__": 10
},
"startRotation3D": false, "startRotation3D": false,
"startRotationX": { "startRotationX": {
"__id__": 10
},
"startRotationY": {
"__id__": 11 "__id__": 11
}, },
"startRotationY": {
"__id__": 12
},
"startRotationZ": { "startRotationZ": {
"__id__": 12
},
"startRotation": {
"__id__": 12
},
"startDelay": {
"__id__": 13 "__id__": 13
}, },
"startLifetime": { "startRotation": {
"__id__": 13
},
"startDelay": {
"__id__": 14 "__id__": 14
}, },
"startLifetime": {
"__id__": 15
},
"duration": 1, "duration": 1,
"loop": true, "loop": true,
"simulationSpeed": 1, "simulationSpeed": 1,
"playOnAwake": true, "playOnAwake": true,
"gravityModifier": { "gravityModifier": {
"__id__": 15
},
"rateOverTime": {
"__id__": 16 "__id__": 16
}, },
"rateOverDistance": { "rateOverTime": {
"__id__": 17 "__id__": 17
}, },
"rateOverDistance": {
"__id__": 18
},
"bursts": [], "bursts": [],
"_renderCulling": false, "_renderCulling": false,
"_cullingMode": 0, "_cullingMode": 0,
@ -197,37 +247,37 @@
"_dataCulling": false, "_dataCulling": false,
"enableCulling": false, "enableCulling": false,
"_colorOverLifetimeModule": { "_colorOverLifetimeModule": {
"__id__": 18 "__id__": 19
}, },
"_shapeModule": { "_shapeModule": {
"__id__": 20 "__id__": 21
}, },
"_sizeOvertimeModule": { "_sizeOvertimeModule": {
"__id__": 22 "__id__": 23
}, },
"_velocityOvertimeModule": { "_velocityOvertimeModule": {
"__id__": 27 "__id__": 28
}, },
"_forceOvertimeModule": { "_forceOvertimeModule": {
"__id__": 32 "__id__": 33
}, },
"_limitVelocityOvertimeModule": { "_limitVelocityOvertimeModule": {
"__id__": 36 "__id__": 37
}, },
"_rotationOvertimeModule": { "_rotationOvertimeModule": {
"__id__": 41 "__id__": 42
}, },
"_textureAnimationModule": { "_textureAnimationModule": {
"__id__": 45 "__id__": 46
}, },
"_noiseModule": { "_noiseModule": {
"__id__": 49
},
"_trailModule": {
"__id__": 50 "__id__": 50
}, },
"_trailModule": {
"__id__": 51
},
"renderer": { "renderer": {
"__id__": 59 "__id__": 60
}, },
"_prewarm": true, "_prewarm": true,
"_capacity": 1, "_capacity": 1,
@ -325,7 +375,7 @@
"__type__": "cc.ColorOvertimeModule", "__type__": "cc.ColorOvertimeModule",
"_enable": false, "_enable": false,
"color": { "color": {
"__id__": 19 "__id__": 20
} }
}, },
{ {
@ -354,7 +404,7 @@
"arcMode": 0, "arcMode": 0,
"arcSpread": 0, "arcSpread": 0,
"arcSpeed": { "arcSpeed": {
"__id__": 21 "__id__": 22
}, },
"length": 5, "length": 5,
"boxThickness": { "boxThickness": {
@ -395,16 +445,16 @@
"_enable": false, "_enable": false,
"separateAxes": false, "separateAxes": false,
"size": { "size": {
"__id__": 23
},
"x": {
"__id__": 24 "__id__": 24
}, },
"y": { "x": {
"__id__": 25 "__id__": 25
}, },
"z": { "y": {
"__id__": 26 "__id__": 26
},
"z": {
"__id__": 27
} }
}, },
{ {
@ -435,17 +485,17 @@
"__type__": "cc.VelocityOvertimeModule", "__type__": "cc.VelocityOvertimeModule",
"_enable": false, "_enable": false,
"x": { "x": {
"__id__": 28
},
"y": {
"__id__": 29 "__id__": 29
}, },
"z": { "y": {
"__id__": 30 "__id__": 30
}, },
"speedModifier": { "z": {
"__id__": 31 "__id__": 31
}, },
"speedModifier": {
"__id__": 32
},
"space": 1 "space": 1
}, },
{ {
@ -476,14 +526,14 @@
"__type__": "cc.ForceOvertimeModule", "__type__": "cc.ForceOvertimeModule",
"_enable": false, "_enable": false,
"x": { "x": {
"__id__": 33
},
"y": {
"__id__": 34 "__id__": 34
}, },
"z": { "y": {
"__id__": 35 "__id__": 35
}, },
"z": {
"__id__": 36
},
"space": 1 "space": 1
}, },
{ {
@ -508,17 +558,17 @@
"__type__": "cc.LimitVelocityOvertimeModule", "__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false, "_enable": false,
"limitX": { "limitX": {
"__id__": 37
},
"limitY": {
"__id__": 38 "__id__": 38
}, },
"limitZ": { "limitY": {
"__id__": 39 "__id__": 39
}, },
"limit": { "limitZ": {
"__id__": 40 "__id__": 40
}, },
"limit": {
"__id__": 41
},
"dampen": 3, "dampen": 3,
"separateAxes": false, "separateAxes": false,
"space": 1 "space": 1
@ -552,13 +602,13 @@
"_enable": false, "_enable": false,
"_separateAxes": false, "_separateAxes": false,
"x": { "x": {
"__id__": 42
},
"y": {
"__id__": 43 "__id__": 43
}, },
"z": { "y": {
"__id__": 44 "__id__": 44
},
"z": {
"__id__": 45
} }
}, },
{ {
@ -589,10 +639,10 @@
"_mode": 0, "_mode": 0,
"animation": 0, "animation": 0,
"frameOverTime": { "frameOverTime": {
"__id__": 46 "__id__": 47
}, },
"startFrame": { "startFrame": {
"__id__": 48 "__id__": 49
}, },
"cycleCount": 0, "cycleCount": 0,
"_flipU": 0, "_flipU": 0,
@ -605,7 +655,7 @@
"__type__": "cc.CurveRange", "__type__": "cc.CurveRange",
"mode": 1, "mode": 1,
"spline": { "spline": {
"__id__": 47 "__id__": 48
}, },
"multiplier": 1 "multiplier": 1
}, },
@ -672,38 +722,38 @@
"_enable": true, "_enable": true,
"mode": 0, "mode": 0,
"lifeTime": { "lifeTime": {
"__id__": 51 "__id__": 52
}, },
"_minParticleDistance": 0.01, "_minParticleDistance": 0.1,
"existWithParticles": true, "existWithParticles": true,
"textureMode": 0, "textureMode": 0,
"widthFromParticle": true, "widthFromParticle": true,
"widthRatio": { "widthRatio": {
"__id__": 52 "__id__": 53
}, },
"colorFromParticle": false, "colorFromParticle": false,
"colorOverTrail": { "colorOverTrail": {
"__id__": 54 "__id__": 55
}, },
"colorOvertime": { "colorOvertime": {
"__id__": 58 "__id__": 56
}, },
"_space": 0, "_space": 0,
"_particleSystem": { "_particleSystem": {
"__id__": 3 "__id__": 4
} }
}, },
{ {
"__type__": "cc.CurveRange", "__type__": "cc.CurveRange",
"mode": 0, "mode": 0,
"constant": 1, "constant": 0.2,
"multiplier": 1 "multiplier": 1
}, },
{ {
"__type__": "cc.CurveRange", "__type__": "cc.CurveRange",
"mode": 1, "mode": 1,
"spline": { "spline": {
"__id__": 53 "__id__": 54
}, },
"multiplier": 1 "multiplier": 1
}, },
@ -711,30 +761,30 @@
"__type__": "cc.RealCurve", "__type__": "cc.RealCurve",
"_times": [ "_times": [
0, 0,
0.11 1
], ],
"_values": [ "_values": [
{ {
"__type__": "cc.RealKeyframeValue", "__type__": "cc.RealKeyframeValue",
"interpolationMode": 2, "interpolationMode": 0,
"tangentWeightMode": 0, "tangentWeightMode": 0,
"value": 1, "value": 1,
"rightTangent": -15.269841269841269, "rightTangent": -1,
"rightTangentWeight": 1, "rightTangentWeight": 1,
"leftTangent": -15.269841269841269, "leftTangent": -1,
"leftTangentWeight": 1, "leftTangentWeight": 1,
"easingMethod": 0, "easingMethod": 0,
"__editorExtras__": null "__editorExtras__": null
}, },
{ {
"__type__": "cc.RealKeyframeValue", "__type__": "cc.RealKeyframeValue",
"interpolationMode": 2, "interpolationMode": 0,
"tangentWeightMode": 0, "tangentWeightMode": 0,
"value": 0, "value": 0,
"rightTangent": 0, "rightTangent": -1,
"rightTangentWeight": 0, "rightTangentWeight": 1,
"leftTangent": 0, "leftTangent": -1,
"leftTangentWeight": 0, "leftTangentWeight": 1,
"easingMethod": 0, "easingMethod": 0,
"__editorExtras__": null "__editorExtras__": null
} }
@ -742,36 +792,6 @@
"preExtrapolation": 1, "preExtrapolation": 1,
"postExtrapolation": 1 "postExtrapolation": 1
}, },
{
"__type__": "cc.GradientRange",
"_mode": 1,
"gradient": {
"__id__": 55
}
},
{
"__type__": "cc.Gradient",
"colorKeys": [],
"alphaKeys": [
{
"__id__": 56
},
{
"__id__": 57
}
],
"mode": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 255,
"time": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 0,
"time": 0.1
},
{ {
"__type__": "cc.GradientRange", "__type__": "cc.GradientRange",
"_mode": 0, "_mode": 0,
@ -783,6 +803,36 @@
"a": 255 "a": 255
} }
}, },
{
"__type__": "cc.GradientRange",
"_mode": 1,
"gradient": {
"__id__": 57
}
},
{
"__type__": "cc.Gradient",
"colorKeys": [],
"alphaKeys": [
{
"__id__": 58
},
{
"__id__": 59
}
],
"mode": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 255,
"time": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 80,
"time": 1
},
{ {
"__type__": "cc.ParticleSystemRenderer", "__type__": "cc.ParticleSystemRenderer",
"_renderMode": 0, "_renderMode": 0,
@ -814,17 +864,65 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 63
},
{
"__id__": 65
}
],
"_prefab": {
"__id__": 67
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 4.547473508864641e-13,
"y": 9.094947017729282e-13,
"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", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {},
"node": { "node": {
"__id__": 1 "__id__": 62
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 62 "__id__": 64
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -840,19 +938,18 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "beBPBHPMpEJraWP8VptTuG" "fileId": "c6kr6bHvhF06OlISCzvjZo"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {},
"node": { "node": {
"__id__": 1 "__id__": 62
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 64 "__id__": 66
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -885,7 +982,88 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "bbNUf7fcREKbdMzeD2KyNQ" "fileId": "d8qmZch/1I9IIpjojV8QG7"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "abz3Mf5VxMEaQoSXBedPx/",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 69
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "7efGvJuVhDObli6TK4s4vI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "44+elJpolOhbUe690US9Nt",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 72
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 200
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "beBPBHPMpEJraWP8VptTuG"
}, },
{ {
"__type__": "cc.CircleCollider2D", "__type__": "cc.CircleCollider2D",
@ -897,7 +1075,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 66 "__id__": 74
}, },
"tag": 0, "tag": 0,
"_group": 4, "_group": 4,
@ -927,7 +1105,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 68 "__id__": 76
}, },
"enabledContactListener": true, "enabledContactListener": true,
"bullet": true, "bullet": true,
@ -960,24 +1138,105 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 70 "__id__": 78
}, },
"_impactPrefab": {
"__uuid__": "e4f226d3-8b68-42b8-8bf0-490b8d5765c4",
"__expectedType__": "cc.Prefab"
},
"_maxSpeed": 100,
"_rigidbody": { "_rigidbody": {
"__id__": 67 "__id__": 75
},
"_sprite": {
"__id__": 62
},
"_trail": {
"__id__": 4
}, },
"_collider": { "_collider": {
"__id__": 65 "__id__": 73
}, },
"_hitSound": { "_hitSound": {
"__uuid__": "6a432293-3852-4267-be19-c671f36fe9f0", "__uuid__": "6a432293-3852-4267-be19-c671f36fe9f0",
"__expectedType__": "cc.AudioClip" "__expectedType__": "cc.AudioClip"
}, },
"_jumpCurve": {
"__id__": 79
},
"_id": "" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "69msKyk8NLHqP+rm4QOaXF" "fileId": "69msKyk8NLHqP+rm4QOaXF"
}, },
{
"__type__": "cc.AnimationCurve",
"_curve": {
"__id__": 80
}
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
0.2,
0.4,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 5.777777777777779,
"rightTangentWeight": 0,
"leftTangent": 5.777777777777779,
"leftTangentWeight": 0,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0.37707337523039497,
"rightTangentWeight": 0,
"leftTangent": 0.37707337523039497,
"leftTangentWeight": 0,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": -0.5622495861888999,
"rightTangentWeight": 0,
"leftTangent": -0.5622495861888999,
"leftTangentWeight": 0,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": -1.877436291594456,
"rightTangentWeight": 1,
"leftTangent": -1.877436291594456,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 2,
"postExtrapolation": 1
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@ -0,0 +1,772 @@
[
{
"__type__": "cc.Prefab",
"_name": "Impact Particle",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "Impact Particle",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 61
},
"_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": 50,
"y": 50,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.ParticleSystem",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_materials": [
{
"__uuid__": "9aa5d037-ec4c-4f5a-9513-4a423d576110",
"__expectedType__": "cc.Material"
}
],
"_visFlags": 0,
"startColor": {
"__id__": 4
},
"scaleSpace": 1,
"startSize3D": false,
"startSizeX": {
"__id__": 5
},
"startSize": {
"__id__": 5
},
"startSizeY": {
"__id__": 6
},
"startSizeZ": {
"__id__": 7
},
"startSpeed": {
"__id__": 8
},
"startRotation3D": false,
"startRotationX": {
"__id__": 9
},
"startRotationY": {
"__id__": 10
},
"startRotationZ": {
"__id__": 11
},
"startRotation": {
"__id__": 11
},
"startDelay": {
"__id__": 12
},
"startLifetime": {
"__id__": 13
},
"duration": 1,
"loop": false,
"simulationSpeed": 1,
"playOnAwake": false,
"gravityModifier": {
"__id__": 14
},
"rateOverTime": {
"__id__": 15
},
"rateOverDistance": {
"__id__": 16
},
"bursts": [
{
"__id__": 17
}
],
"_renderCulling": false,
"_cullingMode": 0,
"_aabbHalfX": 0,
"_aabbHalfY": 0,
"_aabbHalfZ": 0,
"_dataCulling": false,
"enableCulling": false,
"_colorOverLifetimeModule": {
"__id__": 19
},
"_shapeModule": {
"__id__": 24
},
"_sizeOvertimeModule": {
"__id__": 26
},
"_velocityOvertimeModule": {
"__id__": 32
},
"_forceOvertimeModule": {
"__id__": 37
},
"_limitVelocityOvertimeModule": {
"__id__": 41
},
"_rotationOvertimeModule": {
"__id__": 46
},
"_textureAnimationModule": {
"__id__": 50
},
"_noiseModule": {
"__id__": 54
},
"_trailModule": {
"__id__": 55
},
"renderer": {
"__id__": 60
},
"_prewarm": false,
"_capacity": 100,
"_simulationSpace": 1,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e5RR/Euk5E1aiVQtB8bWtU"
},
{
"__type__": "cc.GradientRange",
"_mode": 0,
"color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 1.5,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 5,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0.2,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.Burst",
"_time": 0,
"_repeatCount": 1,
"repeatInterval": 0.01,
"count": {
"__id__": 18
}
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 1,
"multiplier": 1
},
{
"__type__": "cc.ColorOvertimeModule",
"_enable": false,
"color": {
"__id__": 20
}
},
{
"__type__": "cc.GradientRange",
"_mode": 1,
"gradient": {
"__id__": 21
}
},
{
"__type__": "cc.Gradient",
"colorKeys": [],
"alphaKeys": [
{
"__id__": 22
},
{
"__id__": 23
}
],
"mode": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 255,
"time": 0
},
{
"__type__": "cc.AlphaKey",
"alpha": 100,
"time": 1
},
{
"__type__": "cc.ShapeModule",
"_enable": false,
"_shapeType": 2,
"shapeType": 2,
"emitFrom": 0,
"alignToDirection": false,
"randomDirectionAmount": 0,
"sphericalDirectionAmount": 0,
"randomPositionAmount": 0,
"radius": 1,
"radiusThickness": 1,
"arcMode": 0,
"arcSpread": 0,
"arcSpeed": {
"__id__": 25
},
"length": 5,
"boxThickness": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_position": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_rotation": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_arc": 6.283185307179586,
"_angle": 0.4363323129985824
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 1,
"multiplier": 1
},
{
"__type__": "cc.SizeOvertimeModule",
"_enable": true,
"separateAxes": false,
"size": {
"__id__": 27
},
"x": {
"__id__": 29
},
"y": {
"__id__": 30
},
"z": {
"__id__": 31
}
},
{
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 28
},
"multiplier": 1
},
{
"__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": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.VelocityOvertimeModule",
"_enable": false,
"x": {
"__id__": 33
},
"y": {
"__id__": 34
},
"z": {
"__id__": 35
},
"speedModifier": {
"__id__": 36
},
"space": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 1,
"multiplier": 1
},
{
"__type__": "cc.ForceOvertimeModule",
"_enable": false,
"x": {
"__id__": 38
},
"y": {
"__id__": 39
},
"z": {
"__id__": 40
},
"space": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false,
"limitX": {
"__id__": 42
},
"limitY": {
"__id__": 43
},
"limitZ": {
"__id__": 44
},
"limit": {
"__id__": 45
},
"dampen": 3,
"separateAxes": false,
"space": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.RotationOvertimeModule",
"_enable": false,
"_separateAxes": false,
"x": {
"__id__": 47
},
"y": {
"__id__": 48
},
"z": {
"__id__": 49
}
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.TextureAnimationModule",
"_enable": false,
"_numTilesX": 0,
"numTilesX": 0,
"_numTilesY": 0,
"numTilesY": 0,
"_mode": 0,
"animation": 0,
"frameOverTime": {
"__id__": 51
},
"startFrame": {
"__id__": 53
},
"cycleCount": 0,
"_flipU": 0,
"_flipV": 0,
"_uvChannelMask": -1,
"randomRow": false,
"rowIndex": 0
},
{
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 52
},
"multiplier": 1
},
{
"__type__": "cc.RealCurve",
"_times": [
0,
1
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 0,
"leftTangent": 0,
"leftTangentWeight": 0,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 2,
"tangentWeightMode": 0,
"value": 1,
"rightTangent": 0,
"rightTangentWeight": 0,
"leftTangent": 0,
"leftTangentWeight": 0,
"easingMethod": 0,
"__editorExtras__": null
}
],
"preExtrapolation": 1,
"postExtrapolation": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.NoiseModule",
"_enable": false,
"_strengthX": 10,
"_strengthY": 10,
"_strengthZ": 10,
"_noiseSpeedX": 0,
"_noiseSpeedY": 0,
"_noiseSpeedZ": 0,
"_noiseFrequency": 1,
"_remapX": 0,
"_remapY": 0,
"_remapZ": 0,
"_octaves": 1,
"_octaveMultiplier": 0.5,
"_octaveScale": 2
},
{
"__type__": "cc.TrailModule",
"_enable": false,
"mode": 0,
"lifeTime": {
"__id__": 56
},
"_minParticleDistance": 0.1,
"existWithParticles": true,
"textureMode": 0,
"widthFromParticle": true,
"widthRatio": {
"__id__": 57
},
"colorFromParticle": false,
"colorOverTrail": {
"__id__": 58
},
"colorOvertime": {
"__id__": 59
},
"_space": 0,
"_particleSystem": {
"__id__": 2
}
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 1,
"multiplier": 1
},
{
"__type__": "cc.CurveRange",
"mode": 0,
"constant": 0,
"multiplier": 1
},
{
"__type__": "cc.GradientRange",
"_mode": 0,
"color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
},
{
"__type__": "cc.GradientRange",
"_mode": 0,
"color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
},
{
"__type__": "cc.ParticleSystemRenderer",
"_renderMode": 0,
"_velocityScale": 1,
"_lengthScale": 1,
"_mesh": null,
"_cpuMaterial": {
"__uuid__": "9aa5d037-ec4c-4f5a-9513-4a423d576110",
"__expectedType__": "cc.Material"
},
"_gpuMaterial": null,
"_mainTexture": {
"__uuid__": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@6c48a",
"__expectedType__": "cc.Texture2D"
},
"_useGPU": false,
"_alignSpace": 2
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "02Cq1VgJZE6L0Djr0XraDM",
"instance": null,
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.43",
"importer": "prefab",
"imported": true,
"uuid": "e4f226d3-8b68-42b8-8bf0-490b8d5765c4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "Impact Particle"
}
}

View File

@ -0,0 +1,243 @@
[
{
"__type__": "cc.Prefab",
"_name": "box",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "box",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 4
},
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 10
}
],
"_prefab": {
"__id__": 12
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -521.891,
"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": 20,
"height": 50
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "dd1k5yz/9Jw7Y3h/ln7e+D"
},
{
"__type__": "cc.Sprite",
"_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
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "33Vv42hplKv6Fr1cHzlkpg"
},
{
"__type__": "ab3adcigCNMO4YLHg1OcMdG",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_collider": {
"__id__": 8
},
"_sprite": {
"__id__": 4
},
"_score": 10,
"_flySpeed": 500,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fc99DKgwZBHalLOt5fRIss"
},
{
"__type__": "cc.BoxCollider2D",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 9
},
"tag": 0,
"_group": 16,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 20,
"height": 50
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e3xI5cN0VBUb2QzjmBNBDQ"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_group": 16,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bbOXJ9GJVHppWgt0OjwEBK"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "31K2tUn39G47RitJdKcKW+",
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.43",
"importer": "prefab",
"imported": true,
"uuid": "f5073081-8dd5-444f-b755-d18d38aa98fb",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "box"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
enum GameEvent {
GameStateChange,
BallHit,
}
export default GameEvent;

View File

@ -0,0 +1,10 @@
import { Enum } from 'cc';
enum PhysicsGroup {
DEFAULT = 1 << 0,
TRIGGER = 1 << 1,
BALL = 1 << 2,
BALLTHROWING = 1 << 3,
}
export default Enum(PhysicsGroup);

View File

@ -2,7 +2,7 @@
"ver": "4.0.23", "ver": "4.0.23",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "b1eecaf3-413b-4baa-b963-ac905620d203", "uuid": "abe5050b-d03f-43e5-a763-814051bfe9e0",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}

View File

@ -0,0 +1,6 @@
enum ScoreType {
Goal,
DestroyObject,
}
export default ScoreType;

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b5068470-ca45-4461-957c-63a3bd41944f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -2,7 +2,7 @@
"ver": "1.1.0", "ver": "1.1.0",
"importer": "directory", "importer": "directory",
"imported": true, "imported": true,
"uuid": "29983e40-308b-4f9e-9e19-104e958a083b", "uuid": "0d010146-70ff-4b4b-a3cc-143f843657b1",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {

View File

@ -0,0 +1,57 @@
import { _decorator, CCFloat, CCInteger, Collider2D, Color, Component, Contact2DType, Sprite, Vec3 } from 'cc';
import { GameManager } from '../Manager/GameManager';
const { ccclass, property, float } = _decorator;
@ccclass('DamageableObject')
export class DamageableObject extends Component {
@property({ type: Collider2D, visible: true })
private _collider: Collider2D;
@property({ type: Sprite, visible: true })
private _sprite: Sprite;
@property({ type: CCInteger, visible: true })
private _score: number;
@property({ type: CCFloat, visible: true })
private _flySpeed: number;
private _flyDirection: Vec3;
private _targetColor: Color;
private _hitted = false;
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
}
protected update(dt: number): void {
if (this._hitted) {
const pos = new Vec3();
Vec3.multiplyScalar(pos, this._flyDirection, this._flySpeed * dt);
this.node.worldPosition = this.node.getWorldPosition().add(pos);
const scale = new Vec3();
Vec3.multiplyScalar(scale, Vec3.ONE.clone(), 0.5 * dt);
this.node.scale = this.node.getScale().add(scale);
this.node.angle += 800 * dt;
this._sprite.color = this._sprite.color.clone().lerp(this._targetColor, 2 * dt);
if (this._sprite.color.a == 0) {
}
}
}
private onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
if (this._hitted) return;
this._collider.enabled = false;
let center = this.node.getWorldPosition();
let other = otherCollider.node.getWorldPosition();
this._flyDirection = center.subtract(other);
this._flyDirection.normalize();
this._hitted = true;
this._targetColor = this._sprite.color.clone();
this._targetColor.a = 0;
this.node.setSiblingIndex(this.node.parent.children.length - 1);
if (this._score > 0) {
GameManager.instance.destroyEnviromentsObject(this._score);
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ab3ad722-8023-4c3b-860b-1e0d4e70c746",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,19 @@
import { _decorator, CCInteger, Collider2D, Component, Contact2DType, Node } from 'cc';
import { GameManager } from '../Manager/GameManager';
const { ccclass, property, float } = _decorator;
@ccclass('Goal')
export class Goal extends Component {
@property({ type: Collider2D, visible: true })
private _collider: Collider2D;
@property({ type: CCInteger, visible: true })
private _score: number;
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
}
private onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
GameManager.instance.goal(this._score, otherCollider.node);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "4aff560e-243a-45dd-99f1-c35c3f3ac982",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "2337eea2-81d3-4031-842a-83912dd198d5",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -0,0 +1,19 @@
import GameState from '../Enum/GameState';
import ScoreType from '../Enum/ScoreType';
enum GameEvent {
GameStateChange,
Score,
}
export interface GameEventCallbackMap {
[GameEvent.GameStateChange]: (state: GameState) => void;
[GameEvent.Score]: (type: ScoreType, score: number) => void;
}
export interface GameEventArgMap {
[GameEvent.GameStateChange]: GameState;
[GameEvent.Score]: [ScoreType, number];
}
export default GameEvent;

View File

@ -2,7 +2,7 @@
"ver": "4.0.23", "ver": "4.0.23",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "a28ecc68-efbe-427e-8f18-5712ec3b9c2e", "uuid": "81dc3a0a-e13c-45ac-a582-34d2eb7e8c44",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}

View File

@ -11,23 +11,44 @@ import {
IPhysics2DContact, IPhysics2DContact,
RigidBody2D, RigidBody2D,
Vec2, Vec2,
geometry,
math,
Node,
Vec3,
ParticleSystem,
Prefab,
CircleCollider2D,
} from 'cc'; } from 'cc';
import IPoolable from '../Pool/IPoolable'; import IPoolable from '../Pool/IPoolable';
import { SoundManager } from '../Manager/SoundManager'; import { SoundManager } from '../Manager/SoundManager';
import PhysicsGroup from '../Enum/PhysicGroup';
import ObjectPool from '../Pool/ObjectPool';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('Ball') @ccclass('Ball')
export class Ball extends Component implements IPoolable { export class Ball extends Component implements IPoolable {
@property({ type: Prefab, visible: true })
private _impactPrefab: Prefab;
@property({ type: CCFloat, visible: true }) @property({ type: CCFloat, visible: true })
private _maxSpeed: number; private _maxSpeed: number;
@property({ type: RigidBody2D, visible: true }) @property({ type: RigidBody2D, visible: true })
private _rigidbody: RigidBody2D; private _rigidbody: RigidBody2D;
@property({ type: Collider2D, visible: true }) @property({ type: Node, visible: true })
private _collider: Collider2D; private _sprite: Node;
@property({ type: ParticleSystem, visible: true })
private _trail: ParticleSystem;
@property({ type: CircleCollider2D, visible: true })
private _collider: CircleCollider2D;
@property({ type: AudioClip, visible: true }) @property({ type: AudioClip, visible: true })
private _hitSound: AudioClip; private _hitSound: AudioClip;
@property({ type: geometry.AnimationCurve, visible: true })
private _jumpCurve: geometry.AnimationCurve = new geometry.AnimationCurve();
private _impactPool: ObjectPool;
private _hitted = false; private _hitted = false;
private _isJumping = false;
private _jumpTime: number;
private _jumpDuration: number;
public eventHitObstacle = new EventTarget(); public eventHitObstacle = new EventTarget();
public eventGoal = new EventTarget(); public eventGoal = new EventTarget();
@ -38,33 +59,79 @@ export class Ball extends Component implements IPoolable {
this._collider.on(Contact2DType.END_CONTACT, this.onEndContact, this); this._collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
} }
director.on(Director.EVENT_AFTER_PHYSICS, this.setMaxVelocity, this); director.on(Director.EVENT_AFTER_PHYSICS, this.setMaxVelocity, this);
this._impactPool = new ObjectPool(this._impactPrefab, 5, false);
}
protected update(dt: number): void {
if (this._isJumping) {
this._jumpTime += dt;
let jumpProcess = this._jumpTime / this._jumpDuration;
jumpProcess = math.clamp01(jumpProcess);
let scale = Vec3.ONE.clone();
scale = scale.add(Vec3.ONE.clone().multiplyScalar(this._jumpCurve.evaluate(jumpProcess)));
this._sprite.setScale(scale);
this._trail.trailModule.widthRatio.multiplier = scale.x;
if (jumpProcess >= 1) {
this._sprite.setScale(Vec3.ONE);
this._trail.trailModule.widthRatio.multiplier = 1;
this._isJumping = false;
this._collider.group = PhysicsGroup.BALL;
this._rigidbody.group = PhysicsGroup.BALL;
}
}
} }
private onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) { private onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if (this._hitted) return; if (this._hitted) return;
this._hitted = true; this._hitted = true;
if (this._rigidbody.linearVelocity.length() >= 3) { if (this._rigidbody.linearVelocity.length() >= 3) {
let hitPoint = contact.getWorldManifold().points[0];
if (!hitPoint) {
const dir = otherCollider.node
.getWorldPosition()
.subtract(selfCollider.node.getWorldPosition())
.normalize();
dir.multiplyScalar(this._collider.radius / 2);
const point = selfCollider.node.getWorldPosition().add(dir);
hitPoint = new Vec2(point.x, point.y);
}
const hitfx = this._impactPool.get(this.node.parent, ParticleSystem);
hitfx.node.setWorldPosition(new Vec3(hitPoint.x, hitPoint.y, 10));
hitfx.play();
SoundManager.instance.playSfx(this._hitSound); SoundManager.instance.playSfx(this._hitSound);
} }
} }
private setMaxVelocity() {
if (this._rigidbody.linearVelocity.length() > this._maxSpeed) {
this._rigidbody.linearVelocity = this._rigidbody.linearVelocity.normalize().multiplyScalar(this._maxSpeed);
}
}
private onEndContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) { private onEndContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
// console.log(otherCollider.tag, otherCollider.node.name); // console.log(otherCollider.tag, otherCollider.node.name);
this._hitted = false; this._hitted = false;
} }
public addFocre(force: Vec2) { private setMaxVelocity() {
const point = this.node.getWorldPosition(); if (this._rigidbody.linearVelocity.length() > this._maxSpeed) {
this._rigidbody.applyLinearImpulse(force, new Vec2(point.x, point.y), true); this._rigidbody.linearVelocity = this._rigidbody.linearVelocity.normalize().multiplyScalar(this._maxSpeed);
}
} }
reuse() {} public addFocre(force: Vec2) {
this._rigidbody.applyLinearImpulseToCenter(force, true);
}
public throwBall(force: Vec2) {
this._collider.group = PhysicsGroup.BALLTHROWING;
this._rigidbody.group = PhysicsGroup.BALLTHROWING;
this._rigidbody.applyLinearImpulseToCenter(force, true);
this._isJumping = true;
this._jumpTime = 0;
this._jumpDuration = this._rigidbody.linearVelocity.length() * 0.05;
}
reuse() {
this._isJumping = false;
this._hitted = false;
}
unuse() { unuse() {
this._rigidbody.linearVelocity = Vec2.ZERO.clone(); this._rigidbody.linearVelocity = Vec2.ZERO.clone();

View File

@ -1,12 +0,0 @@
import GameEvent from '../Enum/GameEvent';
import GameState from '../Enum/GameState';
export interface GameEventCallbackMap {
[GameEvent.GameStateChange]: (state: GameState) => void;
[GameEvent.BallHit]: () => void;
}
export interface GameEventArgMap {
[GameEvent.GameStateChange]: GameState;
[GameEvent.BallHit]: null;
}

View File

@ -1,6 +1,5 @@
import { __private, _decorator, Component, EventTarget, Node } from 'cc'; import { __private, _decorator, Component, EventTarget, Node } from 'cc';
import GameEvent from '../Enum/GameEvent'; import { GameEventArgMap, GameEventCallbackMap } from '../Events/GameEvent';
import { GameEventArgMap, GameEventCallbackMap } from '../Interface/GameEventMap';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('EventManger') @ccclass('EventManger')

View File

@ -4,7 +4,8 @@ import { Ball } from '../Gameplay/Ball';
import Utilities from '../Utilities/Utilities'; import Utilities from '../Utilities/Utilities';
import GameState from '../Enum/GameState'; import GameState from '../Enum/GameState';
import { EventManger } from './EventManger'; import { EventManger } from './EventManger';
import GameEvent from '../Enum/GameEvent'; import GameEvent from '../Events/GameEvent';
import ScoreType from '../Enum/ScoreType';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('GameManager') @ccclass('GameManager')
@ -17,7 +18,8 @@ export class GameManager extends Component {
@property({ type: Prefab, visible: true }) @property({ type: Prefab, visible: true })
private _ballPrefab: Prefab; private _ballPrefab: Prefab;
@property({ type: Vec3, visible: true })
@property({ visible: true })
private _ballSpawnPosition: Vec3; private _ballSpawnPosition: Vec3;
@property({ type: CCInteger, visible: true }) @property({ type: CCInteger, visible: true })
private _balls = 3; private _balls = 3;
@ -26,16 +28,15 @@ export class GameManager extends Component {
private _gameState = GameState.Init; private _gameState = GameState.Init;
public highestStreak: number; public highestStreak: number;
public score = 0; private _score = 0;
protected onLoad(): void { protected onLoad(): void {
GameManager._instance = this; GameManager._instance = this;
this._ballPool = new ObjectPool(this._ballPrefab, 10, false, Ball); this._ballPool = new ObjectPool(this._ballPrefab, 10, true, Ball);
} }
protected async start() { protected start() {
// this.spawnBall(); this.spawnBall();
const a = [1, 4, 4, 5];
} }
private changeGameState(state: GameState) { private changeGameState(state: GameState) {
@ -43,6 +44,12 @@ export class GameManager extends Component {
EventManger.instance.emit(GameEvent.GameStateChange, this._gameState); EventManger.instance.emit(GameEvent.GameStateChange, this._gameState);
} }
private addScore(score: number, type: ScoreType) {
this._score += score;
console.log('score:' + this._score);
EventManger.instance.emit(GameEvent.Score, [type, this._score]);
}
public spawnBall(): Ball { public spawnBall(): Ball {
const ball = this._ballPool.get(this.node, Ball); const ball = this._ballPool.get(this.node, Ball);
ball.node.setPosition(this._ballSpawnPosition); ball.node.setPosition(this._ballSpawnPosition);
@ -51,18 +58,29 @@ export class GameManager extends Component {
dir = randomRangeInt(-1, 2); dir = randomRangeInt(-1, 2);
} }
const force = new Vec2(dir, 1); const force = new Vec2(dir, 1);
ball.addFocre(force.multiply2f(1, 50)); ball.throwBall(force.multiply2f(1, 40));
return ball; return ball;
} }
public async ballOut(ball: Node) { public async ballOut(ball: Node) {
this._balls--; this._balls--;
this._ballPool.release(ball);
if (this._balls === 0) { if (this._balls === 0) {
return; return;
} }
this._ballPool.release(ball);
await Utilities.delay(1000); await Utilities.delay(1000);
// this.spawnBall(); this.spawnBall();
}
public async goal(bonusScore: number, ball: Node) {
this._ballPool.release(ball);
this.addScore(bonusScore, ScoreType.Goal);
await Utilities.delay(1000);
this.spawnBall();
}
public destroyEnviromentsObject(bonusScore: number) {
this.addScore(bonusScore, ScoreType.DestroyObject);
} }
public onRevive() { public onRevive() {

View File

@ -0,0 +1,21 @@
import { _decorator, Component, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('SpawnObjectManager')
export class SpawnObjectManager extends Component {
//#region singleton
private static _instance: SpawnObjectManager = null;
public static get instance(): SpawnObjectManager {
return SpawnObjectManager._instance;
}
//#endregion
@property({ type: [Prefab], visible: true })
private _objects: Prefab[] = [];
@property({ type: [Node], visible: true })
private _spawnPoints: Node[] = [];
protected onLoad(): void {
SpawnObjectManager._instance = this;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "402d0351-87fa-4216-8b59-1bea39684f29",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "df03dc40-3e2b-4190-8ffb-253238758590",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -0,0 +1,14 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('UIController')
export class UIController extends Component {
start() {
}
update(deltaTime: number) {
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ecf072da-d6b3-40f1-88d8-d21f7bc9f59f",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@6c48a",
"displayName": "ring",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7",
"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": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@f9941",
"displayName": "ring",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 262,
"height": 262,
"rawWidth": 262,
"rawHeight": 262,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-131,
-131,
0,
131,
-131,
0,
-131,
131,
0,
131,
131,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
262,
262,
262,
0,
0,
262,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-131,
-131,
0
],
"maxPos": [
131,
131,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"redirect": "55cef4ac-5e35-45d5-90f5-b50f6dcefca7@f9941"
}
}

View File

@ -21,13 +21,34 @@
{ {
"index": 2, "index": 2,
"name": "BALL" "name": "BALL"
},
{
"index": 3,
"name": "BALLTHROWING"
},
{
"index": 4,
"name": "BORDER"
} }
], ],
"collisionMatrix": { "collisionMatrix": {
"0": 5, "0": 21,
"1": 4, "1": 12,
"2": 7 "2": 23,
"3": 18,
"4": 29
} }
}, },
"custom_joint_texture_layouts": [] "custom_joint_texture_layouts": [],
"layer": [],
"sorting-layer": {
"layers": [
{
"id": 0,
"name": "default",
"value": 0
}
],
"increaseId": 2
}
} }