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
99f7e199
Commit
99f7e199
authored
Apr 28, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
done
parent
d2272422
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
598 additions
and
555 deletions
+598
-555
main.fire
assets/main.fire
+580
-550
FragmentJarController.ts
assets/scripts/GamePlay/FragmentJarController.ts
+18
-5
No files found.
assets/main.fire
View file @
99f7e199
This diff is collapsed.
Click to expand it.
assets/scripts/GamePlay/FragmentJarController.ts
View file @
99f7e199
...
@@ -4,7 +4,13 @@ const { ccclass, property } = cc._decorator;
...
@@ -4,7 +4,13 @@ const { ccclass, property } = cc._decorator;
@
ccclass
@
ccclass
export
default
class
FragmentJarController
extends
cc
.
Component
{
export
default
class
FragmentJarController
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
private
fragmentLink
:
cc
.
Node
=
null
;
@
property
private
isBottom
:
boolean
=
false
;
private
_physicsCollider
:
cc
.
PhysicsPolygonCollider
=
null
;
private
_physicsCollider
:
cc
.
PhysicsPolygonCollider
=
null
;
private
_physicsColliderFragmentLink
:
cc
.
PhysicsPolygonCollider
=
null
;
private
_rg
:
cc
.
RigidBody
=
null
;
private
_rg
:
cc
.
RigidBody
=
null
;
private
_siblingIndex
:
number
=
0
;
private
_siblingIndex
:
number
=
0
;
private
_isDropped
:
boolean
=
false
;
private
_isDropped
:
boolean
=
false
;
...
@@ -13,6 +19,7 @@ export default class FragmentJarController extends cc.Component {
...
@@ -13,6 +19,7 @@ export default class FragmentJarController extends cc.Component {
onLoad
()
{
onLoad
()
{
this
.
_physicsCollider
=
this
.
node
.
getComponent
(
cc
.
PhysicsPolygonCollider
);
this
.
_physicsCollider
=
this
.
node
.
getComponent
(
cc
.
PhysicsPolygonCollider
);
this
.
_physicsColliderFragmentLink
=
this
.
fragmentLink
&&
this
.
fragmentLink
.
getComponent
(
cc
.
PhysicsPolygonCollider
);
this
.
_rg
=
this
.
node
.
getComponent
(
cc
.
RigidBody
);
this
.
_rg
=
this
.
node
.
getComponent
(
cc
.
RigidBody
);
this
.
_siblingIndex
=
this
.
node
.
getSiblingIndex
();
this
.
_siblingIndex
=
this
.
node
.
getSiblingIndex
();
this
.
_slots
=
this
.
node
.
children
;
this
.
_slots
=
this
.
node
.
children
;
...
@@ -36,14 +43,21 @@ export default class FragmentJarController extends cc.Component {
...
@@ -36,14 +43,21 @@ export default class FragmentJarController extends cc.Component {
}
}
private
checkTouch
(
point
:
cc
.
Vec2
)
{
private
checkTouch
(
point
:
cc
.
Vec2
)
{
if
(
this
.
_isDropped
)
{
if
(
this
.
_isDropped
||
this
.
isBottom
)
{
return
;
return
;
}
}
const
pos
=
point
.
clone
().
subtract
(
cc
.
v2
(
this
.
node
.
position
.
x
,
this
.
node
.
position
.
y
));
const
pos
=
point
.
clone
().
subtract
(
cc
.
v2
(
this
.
node
.
position
.
x
,
this
.
node
.
position
.
y
));
let
isInside
=
cc
.
Intersection
.
pointInPolygon
(
pos
,
this
.
_physicsCollider
.
points
);
const
isInside
=
cc
.
Intersection
.
pointInPolygon
(
pos
,
this
.
_physicsCollider
.
points
);
let
isInsideFragmentLink
=
false
;
if
(
this
.
_physicsColliderFragmentLink
)
{
const
posFragmentLink
=
point
.
clone
().
subtract
(
cc
.
v2
(
this
.
fragmentLink
.
position
.
x
,
this
.
fragmentLink
.
position
.
y
));
isInsideFragmentLink
=
cc
.
Intersection
.
pointInPolygon
(
posFragmentLink
,
this
.
_physicsColliderFragmentLink
.
points
);
console
.
log
(
'isInside'
,
isInside
,
isInsideFragmentLink
,
this
.
node
.
name
,
this
.
_physicsColliderFragmentLink
.
points
.
length
)
}
if
(
!
isInside
)
{
if
(
!
isInside
&&
!
isInsideFragmentLink
)
{
return
;
return
;
}
}
...
@@ -62,7 +76,6 @@ export default class FragmentJarController extends cc.Component {
...
@@ -62,7 +76,6 @@ export default class FragmentJarController extends cc.Component {
this
.
_isDropped
=
true
;
this
.
_isDropped
=
true
;
const
pos
=
this
.
node
.
position
;
const
pos
=
this
.
node
.
position
;
this
.
node
.
setSiblingIndex
(
-
1
);
this
.
node
.
setSiblingIndex
(
-
1
);
// eventTarget.emit(CHECK_FRAGMENT, this.node.name);
eventTarget
.
emit
(
CHECK_FRAGMENT
,
this
.
node
);
eventTarget
.
emit
(
CHECK_FRAGMENT
,
this
.
node
);
cc
.
tween
(
this
.
node
)
cc
.
tween
(
this
.
node
)
...
...
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