Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dap-hu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Gia Vương
dap-hu
Commits
ac5fbaf3
Commit
ac5fbaf3
authored
May 09, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix drop fragment
parent
d46dc308
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
13 deletions
+31
-13
BottleBreakingScreen.prefab
assets/Prefabs/BottleBreakingScreen.prefab
+3
-3
BehindFragment.ts
assets/scripts/GamePlay/BehindFragment.ts
+14
-3
BreakingJarController.ts
assets/scripts/GamePlay/BreakingJarController.ts
+2
-1
FragmentJarController.ts
assets/scripts/GamePlay/FragmentJarController.ts
+8
-6
Global.ts
assets/scripts/Global.ts
+4
-0
No files found.
assets/Prefabs/BottleBreakingScreen.prefab
View file @
ac5fbaf3
...
...
@@ -6299,7 +6299,7 @@
"__id__": 198
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 201
...
...
@@ -7519,7 +7519,7 @@
"__id__": 205
}
],
"_active":
fals
e,
"_active":
tru
e,
"_components": [],
"_prefab": {
"__id__": 208
...
...
@@ -7841,7 +7841,7 @@
"__id__": 215
}
],
"_active":
fals
e,
"_active":
tru
e,
"_components": [
{
"__id__": 218
...
...
assets/scripts/GamePlay/BehindFragment.ts
View file @
ac5fbaf3
import
{
eventTarget
,
RESET_FRAGMENT
,
SHAKE_FRAGMENT
}
from
"../Events"
;
import
{
Global
}
from
"../Global"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -32,11 +33,20 @@ export default class BehindFragment extends cc.Component {
.
start
();
}
public
onDrop
()
{
this
.
_isDropped
=
true
;
const
position
=
cc
.
v3
(
Math
.
random
()
*
100
-
50
,
Math
.
random
()
*
100
);
cc
.
tween
(
this
.
node
)
.
repeat
(
4
,
cc
.
tween
(
this
.
node
)
.
by
(
Global
.
getRandomTime
(),
{
position
:
cc
.
v3
(
-
5
,
-
5
)
})
.
by
(
Global
.
getRandomTime
(),
{
position
:
cc
.
v3
(
5
,
5
)
})
)
.
start
();
cc
.
tween
(
this
.
node
)
.
by
(
1
,
{
position
})
.
to
(
1
,
{
scale
:
0.9
})
.
call
(()
=>
{
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Dynamic
;
this
.
_rg
.
gravityScale
=
10
;
...
...
@@ -49,5 +59,6 @@ export default class BehindFragment extends cc.Component {
this
.
_physicsCollider
.
enabled
=
false
;
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
node
.
angle
=
0
;
this
.
node
.
scale
=
1
;
}
}
assets/scripts/GamePlay/BreakingJarController.ts
View file @
ac5fbaf3
...
...
@@ -108,7 +108,7 @@ export default class BreakingJarController extends cc.Component {
cc
.
Tween
.
stopAllByTarget
(
this
.
mask
);
cc
.
tween
(
this
.
mask
)
.
to
(
1
,
{
opacity
:
0
})
.
to
(
1
.5
,
{
opacity
:
0
})
.
call
(()
=>
{
eventTarget
.
emit
(
DROP_ALL_FRAGMENT
);
this
.
_behindJarChild
.
forEach
(
item
=>
item
.
onDrop
());
...
...
@@ -116,6 +116,7 @@ export default class BreakingJarController extends cc.Component {
.
delay
(
2
)
.
call
(()
=>
eventTarget
.
emit
(
SHOW_CARD_POPUP
))
.
start
();
this
.
_isEnd
=
true
;
return
;
}
...
...
assets/scripts/GamePlay/FragmentJarController.ts
View file @
ac5fbaf3
import
{
CHECK_FRAGMENT
,
CHECK_TOUCH
,
DROP_ALL_FRAGMENT
,
DROP_TOP_FRAGMENT
,
eventTarget
,
HAMMER
,
PLAY_DROP_SOUND
,
RESET_FRAGMENT
,
SHAKE_FRAGMENT
,
SHOW_FOG
}
from
"../Events"
;
import
{
Global
}
from
"../Global"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -39,6 +40,7 @@ export default class FragmentJarController extends cc.Component {
this
.
_physicsCollider
.
enabled
=
false
;
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
node
.
angle
=
0
;
this
.
node
.
scale
=
1
;
this
.
node
.
setSiblingIndex
(
this
.
_siblingIndex
);
this
.
isDropped
=
false
;
this
.
_numberOfBeats
=
3
;
...
...
@@ -117,15 +119,15 @@ export default class FragmentJarController extends cc.Component {
eventTarget
.
emit
(
CHECK_FRAGMENT
,
this
.
node
);
cc
.
tween
(
this
.
node
)
.
delay
(
0.5
)
.
repeat
(
4
,
cc
.
tween
(
this
.
node
)
.
by
(
Global
.
getRandomTime
(),
{
position
:
cc
.
v3
(
-
5
,
-
5
)
})
.
by
(
Global
.
getRandomTime
(),
{
position
:
cc
.
v3
(
5
,
5
)
})
)
.
to
(
Global
.
getRandomTime
()
*
5
,
{
scale
:
1.1
})
.
call
(()
=>
{
eventTarget
.
emit
(
PLAY_DROP_SOUND
);
this
.
node
.
setSiblingIndex
(
-
1
);
})
.
to
(
0.1
,
{
scale
:
0.9
})
.
to
(
0.1
,
{
scale
:
1.05
})
.
to
(
0.2
,
{
position
:
pos
.
clone
().
multiplyScalar
(
1.2
)
})
.
call
(()
=>
{
this
.
_physicsCollider
.
enabled
=
true
;
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Dynamic
;
this
.
_rg
.
gravityScale
=
10
;
...
...
assets/scripts/Global.ts
View file @
ac5fbaf3
export
class
Global
{
public
static
tool
:
number
=
0
;
public
static
getRandomTime
()
{
return
Math
.
random
()
*
0.05
+
0.03
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment