fix: booster not show after collect once

feature/ads-smart-display
tiendat3699 2024-06-12 23:10:46 +07:00
parent 2017a46914
commit f890a29fb1
7 changed files with 278 additions and 274 deletions

View File

@ -22,7 +22,7 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 10 "__id__": 78
} }
], ],
"_active": true, "_active": true,
@ -86,21 +86,25 @@
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [
{
"__id__": 3
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 3 "__id__": 71
}, },
{ {
"__id__": 5 "__id__": 73
}, },
{ {
"__id__": 7 "__id__": 75
} }
], ],
"_prefab": { "_prefab": {
"__id__": 9 "__id__": 77
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -131,197 +135,34 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 166.52999877929688,
"height": 160.13999938964844
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5016513632852623,
"y": 0.5191707237824722
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8cgS7HLu5PoZB6mL8KbJv8"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "a2e8df4b-a028-47ea-940e-a59e1aa826f0",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c1tC0lYOlLFKA9oivphpal"
},
{
"__type__": "b2937Y+5yVLE4z8uGa84ZqS",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"skeleton": {
"__id__": 5
},
"_flipX": false,
"_flipY": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6iULR29ROkqlLhKZ24pRU"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "eb772pMDdMO7KDMpjPbAfI",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 11
}
],
"_active": true,
"_components": [
{
"__id__": 79
},
{
"__id__": 81
}
],
"_prefab": {
"__id__": 83
},
"_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", "__type__": "cc.Node",
"_name": "Particle", "_name": "Particle",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 10 "__id__": 2
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 12 "__id__": 4
}, },
{ {
"__id__": 14 "__id__": 6
}, },
{ {
"__id__": 76 "__id__": 68
} }
], ],
"_prefab": { "_prefab": {
"__id__": 78 "__id__": 70
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 2.2737367544323206e-13,
"y": 40, "y": -15.384615384615245,
"z": 10 "z": 10
}, },
"_lrot": { "_lrot": {
@ -333,8 +174,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 10, "x": 15.384615384615383,
"y": 10, "y": 15.384615384615383,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -353,11 +194,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 11 "__id__": 3
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 13 "__id__": 5
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -381,11 +222,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 11 "__id__": 3
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 15 "__id__": 7
}, },
"_materials": [ "_materials": [
{ {
@ -396,56 +237,56 @@
], ],
"_visFlags": 0, "_visFlags": 0,
"startColor": { "startColor": {
"__id__": 16 "__id__": 8
}, },
"scaleSpace": 1, "scaleSpace": 1,
"startSize3D": false, "startSize3D": false,
"startSizeX": { "startSizeX": {
"__id__": 17 "__id__": 9
}, },
"startSize": { "startSize": {
"__id__": 17 "__id__": 9
}, },
"startSizeY": { "startSizeY": {
"__id__": 18 "__id__": 10
}, },
"startSizeZ": { "startSizeZ": {
"__id__": 19 "__id__": 11
}, },
"startSpeed": { "startSpeed": {
"__id__": 20 "__id__": 12
}, },
"startRotation3D": false, "startRotation3D": false,
"startRotationX": { "startRotationX": {
"__id__": 21 "__id__": 13
}, },
"startRotationY": { "startRotationY": {
"__id__": 22 "__id__": 14
}, },
"startRotationZ": { "startRotationZ": {
"__id__": 23 "__id__": 15
}, },
"startRotation": { "startRotation": {
"__id__": 23 "__id__": 15
}, },
"startDelay": { "startDelay": {
"__id__": 24 "__id__": 16
}, },
"startLifetime": { "startLifetime": {
"__id__": 25 "__id__": 17
}, },
"duration": 5, "duration": 5,
"loop": true, "loop": true,
"simulationSpeed": 1, "simulationSpeed": 1,
"playOnAwake": true, "playOnAwake": true,
"gravityModifier": { "gravityModifier": {
"__id__": 26 "__id__": 18
}, },
"rateOverTime": { "rateOverTime": {
"__id__": 27 "__id__": 19
}, },
"rateOverDistance": { "rateOverDistance": {
"__id__": 28 "__id__": 20
}, },
"bursts": [], "bursts": [],
"_renderCulling": false, "_renderCulling": false,
@ -456,37 +297,37 @@
"_dataCulling": false, "_dataCulling": false,
"enableCulling": false, "enableCulling": false,
"_colorOverLifetimeModule": { "_colorOverLifetimeModule": {
"__id__": 29 "__id__": 21
}, },
"_shapeModule": { "_shapeModule": {
"__id__": 39 "__id__": 31
}, },
"_sizeOvertimeModule": { "_sizeOvertimeModule": {
"__id__": 41 "__id__": 33
}, },
"_velocityOvertimeModule": { "_velocityOvertimeModule": {
"__id__": 47 "__id__": 39
}, },
"_forceOvertimeModule": { "_forceOvertimeModule": {
"__id__": 52 "__id__": 44
}, },
"_limitVelocityOvertimeModule": { "_limitVelocityOvertimeModule": {
"__id__": 56 "__id__": 48
}, },
"_rotationOvertimeModule": { "_rotationOvertimeModule": {
"__id__": 61 "__id__": 53
}, },
"_textureAnimationModule": { "_textureAnimationModule": {
"__id__": 65 "__id__": 57
}, },
"_noiseModule": { "_noiseModule": {
"__id__": 69 "__id__": 61
}, },
"_trailModule": { "_trailModule": {
"__id__": 70 "__id__": 62
}, },
"renderer": { "renderer": {
"__id__": 75 "__id__": 67
}, },
"_prewarm": false, "_prewarm": false,
"_capacity": 100, "_capacity": 100,
@ -587,41 +428,41 @@
"__type__": "cc.ColorOvertimeModule", "__type__": "cc.ColorOvertimeModule",
"_enable": true, "_enable": true,
"color": { "color": {
"__id__": 30 "__id__": 22
} }
}, },
{ {
"__type__": "cc.GradientRange", "__type__": "cc.GradientRange",
"_mode": 1, "_mode": 1,
"gradient": { "gradient": {
"__id__": 31 "__id__": 23
} }
}, },
{ {
"__type__": "cc.Gradient", "__type__": "cc.Gradient",
"colorKeys": [ "colorKeys": [
{ {
"__id__": 32 "__id__": 24
}, },
{ {
"__id__": 33 "__id__": 25
}, },
{ {
"__id__": 34 "__id__": 26
} }
], ],
"alphaKeys": [ "alphaKeys": [
{ {
"__id__": 35 "__id__": 27
}, },
{ {
"__id__": 36 "__id__": 28
}, },
{ {
"__id__": 37 "__id__": 29
}, },
{ {
"__id__": 38 "__id__": 30
} }
], ],
"mode": 0 "mode": 0
@ -694,7 +535,7 @@
"arcMode": 0, "arcMode": 0,
"arcSpread": 0, "arcSpread": 0,
"arcSpeed": { "arcSpeed": {
"__id__": 40 "__id__": 32
}, },
"length": 5, "length": 5,
"boxThickness": { "boxThickness": {
@ -735,23 +576,23 @@
"_enable": true, "_enable": true,
"separateAxes": false, "separateAxes": false,
"size": { "size": {
"__id__": 42 "__id__": 34
}, },
"x": { "x": {
"__id__": 44 "__id__": 36
}, },
"y": { "y": {
"__id__": 45 "__id__": 37
}, },
"z": { "z": {
"__id__": 46 "__id__": 38
} }
}, },
{ {
"__type__": "cc.CurveRange", "__type__": "cc.CurveRange",
"mode": 1, "mode": 1,
"spline": { "spline": {
"__id__": 43 "__id__": 35
}, },
"multiplier": 1 "multiplier": 1
}, },
@ -825,16 +666,16 @@
"__type__": "cc.VelocityOvertimeModule", "__type__": "cc.VelocityOvertimeModule",
"_enable": false, "_enable": false,
"x": { "x": {
"__id__": 48 "__id__": 40
}, },
"y": { "y": {
"__id__": 49 "__id__": 41
}, },
"z": { "z": {
"__id__": 50 "__id__": 42
}, },
"speedModifier": { "speedModifier": {
"__id__": 51 "__id__": 43
}, },
"space": 1 "space": 1
}, },
@ -866,13 +707,13 @@
"__type__": "cc.ForceOvertimeModule", "__type__": "cc.ForceOvertimeModule",
"_enable": false, "_enable": false,
"x": { "x": {
"__id__": 53 "__id__": 45
}, },
"y": { "y": {
"__id__": 54 "__id__": 46
}, },
"z": { "z": {
"__id__": 55 "__id__": 47
}, },
"space": 1 "space": 1
}, },
@ -898,16 +739,16 @@
"__type__": "cc.LimitVelocityOvertimeModule", "__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false, "_enable": false,
"limitX": { "limitX": {
"__id__": 57 "__id__": 49
}, },
"limitY": { "limitY": {
"__id__": 58 "__id__": 50
}, },
"limitZ": { "limitZ": {
"__id__": 59 "__id__": 51
}, },
"limit": { "limit": {
"__id__": 60 "__id__": 52
}, },
"dampen": 3, "dampen": 3,
"separateAxes": false, "separateAxes": false,
@ -942,13 +783,13 @@
"_enable": true, "_enable": true,
"_separateAxes": false, "_separateAxes": false,
"x": { "x": {
"__id__": 62 "__id__": 54
}, },
"y": { "y": {
"__id__": 63 "__id__": 55
}, },
"z": { "z": {
"__id__": 64 "__id__": 56
} }
}, },
{ {
@ -980,10 +821,10 @@
"_mode": 0, "_mode": 0,
"animation": 0, "animation": 0,
"frameOverTime": { "frameOverTime": {
"__id__": 66 "__id__": 58
}, },
"startFrame": { "startFrame": {
"__id__": 68 "__id__": 60
}, },
"cycleCount": 0, "cycleCount": 0,
"_flipU": 0, "_flipU": 0,
@ -996,7 +837,7 @@
"__type__": "cc.CurveRange", "__type__": "cc.CurveRange",
"mode": 1, "mode": 1,
"spline": { "spline": {
"__id__": 67 "__id__": 59
}, },
"multiplier": 1 "multiplier": 1
}, },
@ -1063,21 +904,21 @@
"_enable": false, "_enable": false,
"mode": 0, "mode": 0,
"lifeTime": { "lifeTime": {
"__id__": 71 "__id__": 63
}, },
"_minParticleDistance": 0.1, "_minParticleDistance": 0.1,
"existWithParticles": true, "existWithParticles": true,
"textureMode": 0, "textureMode": 0,
"widthFromParticle": true, "widthFromParticle": true,
"widthRatio": { "widthRatio": {
"__id__": 72 "__id__": 64
}, },
"colorFromParticle": false, "colorFromParticle": false,
"colorOverTrail": { "colorOverTrail": {
"__id__": 73 "__id__": 65
}, },
"colorOvertime": { "colorOvertime": {
"__id__": 74 "__id__": 66
}, },
"_space": 0, "_space": 0,
"_particleSystem": null "_particleSystem": null
@ -1140,11 +981,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 11 "__id__": 3
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 77 "__id__": 69
}, },
"_id": "" "_id": ""
}, },
@ -1161,8 +1002,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "84py8yOJVJWZOHcC5itxPh", "fileId": "84py8yOJVJWZOHcC5itxPh",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -1171,7 +1010,166 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 72
},
"_contentSize": {
"__type__": "cc.Size",
"width": 166.52999877929688,
"height": 160.13999938964844
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5016513632852623,
"y": 0.5191707237824722
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8cgS7HLu5PoZB6mL8KbJv8"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 74
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "a2e8df4b-a028-47ea-940e-a59e1aa826f0",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 1,
"_cacheMode": 1,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c1tC0lYOlLFKA9oivphpal"
},
{
"__type__": "b2937Y+5yVLE4z8uGa84ZqS",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 76
},
"skeleton": {
"__id__": 73
},
"_flipX": false,
"_flipY": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6iULR29ROkqlLhKZ24pRU"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "eb772pMDdMO7KDMpjPbAfI",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
},
{
"__id__": 81
}
],
"_prefab": {
"__id__": 83
},
"_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,
"__editorExtras__": {},
"node": {
"__id__": 78
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
@ -1199,7 +1197,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 78
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
@ -1310,7 +1308,7 @@
"displayName": "COLLAGEN JELLY", "displayName": "COLLAGEN JELLY",
"duration": 10, "duration": 10,
"animationHandler": { "animationHandler": {
"__id__": 7 "__id__": 75
}, },
"_id": "" "_id": ""
}, },

View File

@ -336,7 +336,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 540, "x": 540,
"y": 1169.9999999999998, "y": 1169.9999999999995,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@ -387,7 +387,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 2.2737367544323206e-13,
"z": 1000 "z": 1000
}, },
"_lrot": { "_lrot": {
@ -427,7 +427,7 @@
"_priority": 0, "_priority": 0,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 1170, "_orthoHeight": 1169.9999999999998,
"_near": 0, "_near": 0,
"_far": 2000, "_far": 2000,
"_color": { "_color": {
@ -29721,9 +29721,9 @@
"__uuid__": "cc731501-912a-465f-9070-dbe0d8ad3598", "__uuid__": "cc731501-912a-465f-9070-dbe0d8ad3598",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"weight": 60, "weight": 10000,
"weightStepOnGoal": 0, "weightStepOnGoal": 0,
"maxWeight": 60, "maxWeight": 10000,
"maxObjects": 1 "maxObjects": 1
}, },
{ {
@ -34995,7 +34995,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1080, "width": 1080,
"height": 2340 "height": 2339.9999999999995
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",

View File

@ -14,14 +14,14 @@ export class CumulativeBooster extends BoosterBase {
protected onLoad(): void { protected onLoad(): void {
super.onLoad(); super.onLoad();
this.sprite.setNodeActive(true);
this.animationHandler?.setNodeActive(false); this.animationHandler?.setNodeActive(false);
} }
public collect(collector: Node): void { public async collect(collector: Node): Promise<void> {
super.collect(collector); super.collect(collector);
AudioManager.setPlayRateBGM(1.5); AudioManager.setPlayRateBGM(1.5);
this.animationHandler?.setAnimation('active'); await this.animationHandler?.setAnimationAsync('active');
this.animationHandler?.setNodeActive(false);
} }
public end(): void { public end(): void {
@ -33,7 +33,13 @@ export class CumulativeBooster extends BoosterBase {
await super.onGet(); await super.onGet();
if (this.animationHandler) { if (this.animationHandler) {
this.animationHandler.setNodeActive(true); this.animationHandler.setNodeActive(true);
this.animationHandler.setAnimation('idle', { loop: true });
this.sprite.setNodeActive(false); this.sprite.setNodeActive(false);
} }
} }
onRelease(): void {
super.onRelease();
this.animationHandler?.setNodeActive(false);
}
} }

View File

@ -40,12 +40,12 @@ export class ScoreObject extends Component implements IPoolable {
private _originColor: Color; private _originColor: Color;
private _isHit = false; private _isHit = false;
private _enabled: boolean = true; private _colliderEnabled: boolean = true;
protected onLoad(): void { protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this); this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
this._originColor = this._sprite.color.clone(); this._originColor = this._sprite.color.clone();
this._enabled = false; this._colliderEnabled = false;
} }
protected update(dt: number): void { protected update(dt: number): void {
@ -68,10 +68,10 @@ export class ScoreObject extends Component implements IPoolable {
} }
private async onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) { private async onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
if (!this._enabled) return; if (!this._colliderEnabled) return;
if (this._isHit) return; if (this._isHit) return;
if (this._hitSound) AudioManager.playSfx(this._hitSound); if (this._hitSound) AudioManager.playSfx(this._hitSound);
this._enabled = false; this._colliderEnabled = false;
// let center = this.node.getWorldPosition(); // let center = this.node.getWorldPosition();
// let other = otherCollider.node.getWorldPosition(); // let other = otherCollider.node.getWorldPosition();
// this._flyDirection = center.subtract(other); // this._flyDirection = center.subtract(other);
@ -91,12 +91,12 @@ export class ScoreObject extends Component implements IPoolable {
public async onGet() { public async onGet() {
this._animation.play(this._animation.clips[0].name); this._animation.play(this._animation.clips[0].name);
await Utils.delay(this._animation.clips[0].duration); await Utils.delay(this._animation.clips[0].duration);
this._enabled = true; this._colliderEnabled = true;
} }
public onRelease() { public onRelease() {
this._isHit = false; this._isHit = false;
this._enabled = false; this._colliderEnabled = false;
this.node.angle = 0; this.node.angle = 0;
this.node.setScale(Vec3.ONE); this.node.setScale(Vec3.ONE);
this._sprite.color = this._originColor; this._sprite.color = this._originColor;

View File

@ -22,7 +22,7 @@ export default class SlingShot extends Component {
const velocity = other.getComponent(RigidBody2D).linearVelocity.length(); const velocity = other.getComponent(RigidBody2D).linearVelocity.length();
AudioManager.playSfx(this._soundFx); AudioManager.playSfx(this._soundFx);
if (velocity >= 40) { if (velocity >= 40) {
CameraController.instance.shake(0.08); CameraController.instance.shake(0.1);
} }
} }
} }

View File

@ -35,7 +35,7 @@ export class Cannon extends Component {
@property({ type: EventHandler, visible: true }) @property({ type: EventHandler, visible: true })
private onDone: EventHandler[] = []; private onDone: EventHandler[] = [];
private _enabled: boolean = true; private _colliderEnabled: boolean = true;
protected onLoad(): void { protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); this._collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
@ -43,14 +43,14 @@ export class Cannon extends Component {
} }
private async onBeginContact(self: Collider2D, other: Collider2D) { private async onBeginContact(self: Collider2D, other: Collider2D) {
if (!this._enabled) return; if (!this._colliderEnabled) return;
const ball = other.getComponent(Ball); const ball = other.getComponent(Ball);
this._enabled = false; this._colliderEnabled = false;
if (ball) { if (ball) {
ball.clearRigiState(false); ball.clearRigiState(false);
tween(ball.node).to(0.1, { worldPosition: this.node.worldPosition }).start(); tween(ball.node).to(0.1, { worldPosition: this.node.worldPosition }).start();
await Utils.delay(TimeConfig.DelayCannonFire); await Utils.delay(TimeConfig.DelayCannonFire);
CameraController.instance.shake(0.2); CameraController.instance.shake(0.3);
this._animation.play(); this._animation.play();
ball.clearRigiState(true); ball.clearRigiState(true);
ball.throwBall(new Vec2(0, this._force)); ball.throwBall(new Vec2(0, this._force));
@ -63,7 +63,7 @@ export class Cannon extends Component {
private onBallOut() { private onBallOut() {
tween(this._collider.node) tween(this._collider.node)
.to(0.5, { scale: Vec3.ONE }, { easing: 'backOut', onComplete: () => (this._enabled = true) }) .to(0.5, { scale: Vec3.ONE }, { easing: 'backOut', onComplete: () => (this._colliderEnabled = true) })
.start(); .start();
} }
} }

View File

@ -64,7 +64,7 @@ export class MultiBall extends Component {
protected lateUpdate(dt: number): void { protected lateUpdate(dt: number): void {
if (this._trigged) { if (this._trigged) {
CameraController.instance.shake(0.2); CameraController.instance.shake(0.3);
const ball1 = this._originBall; const ball1 = this._originBall;
ball1.clearRigiState(false); ball1.clearRigiState(false);
const ball2 = GameManager.instance.spawnBall(false, false); const ball2 = GameManager.instance.spawnBall(false, false);
@ -83,7 +83,7 @@ export class MultiBall extends Component {
} }
public async spawnBall(quantity: number) { public async spawnBall(quantity: number) {
CameraController.instance.shake(0.2); CameraController.instance.shake(0.3);
this._colliderEnabled = false; this._colliderEnabled = false;
for (let i = 0; i < quantity; i++) { for (let i = 0; i < quantity; i++) {
const ball = GameManager.instance.spawnBall(false, false); const ball = GameManager.instance.spawnBall(false, false);