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
d3dc4b79
Commit
d3dc4b79
authored
Apr 02, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix auto hammer
parent
8900601a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
12 deletions
+7
-12
BreakingBottleController.ts
assets/scripts/GamePlay/BreakingBottleController.ts
+6
-11
FragmentController.ts
assets/scripts/GamePlay/FragmentController.ts
+1
-1
No files found.
assets/scripts/GamePlay/BreakingBottleController.ts
View file @
d3dc4b79
...
...
@@ -45,13 +45,12 @@ export default class BreakingBottleController extends cc.Component {
}
protected
start
():
void
{
this
.
hide
Hammer
();
this
.
reset
Hammer
();
}
private
resetBottle
()
{
this
.
_countFragment
=
0
;
this
.
_spine
.
setSkin
(
this
.
_skins
[
Global
.
tool
%
this
.
_skins
.
length
]);
// this._spine.setAnimation(0, "Dap4", false);
this
.
_fragmentsNode
.
forEach
((
node
,
index
)
=>
{
node
.
position
=
this
.
_fragmentsPosition
[
index
];
...
...
@@ -60,14 +59,14 @@ export default class BreakingBottleController extends cc.Component {
}
private
onHammer
(
newPos
:
cc
.
Vec2
)
{
this
.
hammerNode
.
active
=
false
;
this
.
scheduleOnce
(()
=>
this
.
hammerNode
.
active
=
true
,
0
);
cc
.
Tween
.
stopAllByTarget
(
this
.
hammerNode
);
this
.
_spine
.
setAnimation
(
0
,
"Dap4"
,
false
);
cc
.
tween
(
this
.
hammerNode
)
.
to
(
0
,
{
opacity
:
255
,
position
:
cc
.
v3
(
newPos
.
x
,
newPos
.
y
,
0
),
active
:
false
})
.
to
(
0
,
{
active
:
false
})
.
to
(
0
,
{
active
:
true
})
.
to
(
0
,
{
position
:
cc
.
v3
(
newPos
.
x
,
newPos
.
y
,
0
),
active
:
false
})
.
to
(
0
,
{
active
:
true
})
.
delay
(
1
)
.
to
(
0.5
,
{
position
:
cc
.
v3
(
300
)
})
...
...
@@ -87,18 +86,14 @@ export default class BreakingBottleController extends cc.Component {
const
nodePos
=
this
.
node
.
convertToNodeSpaceAR
(
pos
);
eventTarget
.
emit
(
CHECK_TOUCH
,
nodePos
);
this
.
_spine
.
setSkin
(
this
.
_skins
[
Global
.
tool
%
this
.
_skins
.
length
]);
this
.
_spine
.
setAnimation
(
0
,
"Dap4"
,
false
);
}
private
onTouchEnd
(
event
:
cc
.
Event
.
EventTouch
)
{
}
private
hideHammer
()
{
// this.hammerNode.opacity = 0;
private
resetHammer
()
{
this
.
hammerNode
.
position
=
cc
.
v3
(
300
);
}
...
...
assets/scripts/GamePlay/FragmentController.ts
View file @
d3dc4b79
...
...
@@ -32,7 +32,7 @@ export default class FragmentController extends cc.Component {
private
checkTouch
(
point
:
cc
.
Vec2
)
{
const
pos
=
point
.
clone
().
subtract
(
cc
.
v2
(
this
.
node
.
position
.
x
,
this
.
node
.
position
.
y
));
let
isInside
=
cc
.
Intersection
.
pointInPolygon
(
pos
,
this
.
_collider
.
points
);
if
(
isInside
)
{
eventTarget
.
emit
(
HAMMER
,
point
);
...
...
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