Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Wintersemester 2018-2019
Unity
Suck It
Commits
7cf6460a
Commit
7cf6460a
authored
Mar 28, 2019
by
Unknown
Browse files
som small stuff
parent
f116ba90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Assets/_Game/Scripts/Interaction.meta
deleted
100644 → 0
View file @
f116ba90
fileFormatVersion: 2
guid: 5782222d4c9b9424ea96676650e643a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/_Game/Scripts/Player/MovementController.cs
View file @
7cf6460a
...
...
@@ -7,6 +7,8 @@ using _Game.Scripts.Scriptable_Object;
[
RequireComponent
(
typeof
(
Rigidbody2D
),
typeof
(
CapsuleCollider2D
))]
public
class
MovementController
:
MonoBehaviour
{
[
SerializeField
]
private
PlayerState
r_State
;
[
Header
(
"Movement"
)]
[
SerializeField
]
private
float
m_Speed
=
10f
;
[
SerializeField
]
private
float
m_JumpForce
=
400f
;
// Amount of force added when the player jumps.
[
SerializeField
]
private
float
m_fallMultiplier
=
2.5f
;
...
...
@@ -59,26 +61,6 @@ public class MovementController : MonoBehaviour
m_Rigidbody2D
.
gravityScale
=
state
.
gravity
;
}
public
void
SetSwimming
(
bool
value
)
{
m_Swimming
=
value
;
if
(
value
)
{
OnSwimEvent
.
Invoke
();
m_TempJumpCount
=
m_MaxJumpCount
;
}
}
public
bool
Swimming
{
get
=>
m_Swimming
;
}
public
bool
Grounded
{
get
=>
m_Grounded
;
}
private
void
Awake
()
{
m_Rigidbody2D
=
GetComponent
<
Rigidbody2D
>();
...
...
@@ -106,6 +88,7 @@ public class MovementController : MonoBehaviour
OnLandEvent.Invoke ();
}
}*/
Vector3
pos
=
m_GroundCheck
.
position
+
new
Vector3
(
m_GroundedOffset
.
x
,
m_GroundedOffset
.
y
,
0
);
var
c
=
Physics2D
.
CircleCast
(
pos
,
m_GroundedRadius
,
Vector2
.
down
,
m_ContactFilter2D
,
m_RaycastHits2D
,
m_GroundCheckDistance
);
...
...
@@ -123,6 +106,8 @@ public class MovementController : MonoBehaviour
}
}
public
void
Move
(
Vector2
move
,
bool
jump
)
{
//Debug.Log(m_Swimming);
...
...
@@ -175,6 +160,31 @@ public class MovementController : MonoBehaviour
}
}
public
void
SetSwimming
(
bool
value
)
{
m_Swimming
=
value
;
if
(
value
)
{
OnSwimEvent
.
Invoke
();
m_TempJumpCount
=
m_MaxJumpCount
;
}
}
public
bool
Swimming
{
get
=>
m_Swimming
;
}
public
bool
Grounded
{
get
=>
m_Grounded
;
}
public
void
AddJumpCharge
(
int
amount
)
{
m_TempJumpCount
+=
amount
;
}
private
IEnumerator
Wait
(
float
s
)
{
m_Jumped
=
true
;
...
...
Write
Preview
Supports
Markdown
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