Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tommé Nöll
seedling
Commits
c6b62ceb
Commit
c6b62ceb
authored
Jul 02, 2019
by
Chrysis248
Browse files
rope sichtbar beim Ziehen eines Steins
parent
7a85d8c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Assets/Scripts/RopeSystem.cs
View file @
c6b62ceb
...
...
@@ -145,9 +145,10 @@ public class RopeSystem : MonoBehaviour, VariableSoundPlayer.SoundOwner
springJoint
.
enabled
=
true
;
springJoint
.
distance
=
Vector2
.
Distance
(
playerPosition
,
hit
.
point
);
springJoint
.
connectedBody
=
hit
.
collider
.
GetComponentInParent
<
Rigidbody2D
>();
ropeHingeAnchorSprite
.
enabled
=
true
;
if
(!
springJoint
.
connectedBody
.
GetComponentInParent
<
PullableObject
>().
isHeavy
)
{
springJoint
.
connectedBody
.
gravityScale
=
0.4
f
;
springJoint
.
connectedBody
.
gravityScale
=
1.3
f
;
}
}
else
...
...
@@ -179,7 +180,7 @@ public class RopeSystem : MonoBehaviour, VariableSoundPlayer.SoundOwner
}
if
(
springJoint
.
connectedBody
!=
null
)
{
springJoint
.
connectedBody
.
gravityScale
=
1
f
;
springJoint
.
connectedBody
.
gravityScale
=
20
f
;
}
springJoint
.
enabled
=
false
;
springJoint
.
connectedBody
=
null
;
...
...
@@ -218,7 +219,15 @@ public class RopeSystem : MonoBehaviour, VariableSoundPlayer.SoundOwner
{
if
(
i
!=
ropeRenderer
.
positionCount
-
1
)
// if not the Last point of line renderer
{
ropeRenderer
.
SetPosition
(
i
,
ropePositions
[
i
]);
if
(
springJoint
.
enabled
)
{
ropeRenderer
.
SetPosition
(
i
,
ropeHingeAnchor
.
transform
.
position
);
}
else
{
ropeRenderer
.
SetPosition
(
i
,
ropePositions
[
i
]);
}
// Set the rope anchor to the 2nd to last rope position (where the current hinge/anchor should be) or if only 1 rope position then set that one to anchor point
if
(
i
==
ropePositions
.
Count
-
1
||
ropePositions
.
Count
==
1
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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