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
ca2169ad
Commit
ca2169ad
authored
Mar 29, 2019
by
Sebastian Frey
Browse files
Merge remote-tracking branch 'origin/master'
parents
cc0eebdb
20b16ac2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Assets/_Game/Scripts/Player/InputController.cs
View file @
ca2169ad
...
...
@@ -22,6 +22,6 @@ public class InputController : MonoBehaviour {
m_Jump
=
Input
.
GetKeyDown
(
KeyCode
.
Space
)
||
Input
.
GetKeyDown
(
KeyCode
.
UpArrow
)
||
Input
.
GetKeyDown
(
KeyCode
.
W
);
//Ruft Move Methode im MovementController auf dient der Bewegung des Charakters
m_Controller
.
Move
(
new
Vector2
(
m_XAxis
,
m_YAxis
),
m_Jump
);
m_Controller
.
Move
(
new
Vector2
(
m_XAxis
,
0
),
m_Jump
);
}
}
Assets/_Game/Scripts/Player/MovementController.cs
View file @
ca2169ad
...
...
@@ -112,12 +112,10 @@ public class MovementController : MonoBehaviour
public
void
Move
(
Vector2
move
,
bool
jump
)
{
m_Movement
=
move
;
//only control the player if grounded or airControl is turned on
if
(
m_Grounded
||
(
m_AirControl
&&
(
m_Airborn
&&
!
m_Grounded
))
||
(
m_Swimming
&&
m_CanSwim
))
{
// Move the character by finding the target velocity
Vector2
targetVelocity
=
new
Vector2
((
move
.
x
*
m_Speed
*
Time
.
deltaTime
)
*
10f
,
m_Rigidbody2D
.
velocity
.
y
);
...
...
@@ -246,14 +244,19 @@ public class MovementController : MonoBehaviour
private
void
OnCollisionEnter2D
(
Collision2D
other
)
{
if
(
other
.
gameObject
.
layer
==
9
)
if
(
m_WhatIsGround
==
(
m_WhatIsGround
|
(
1
<<
other
.
gameObject
.
layer
))){
m_Airborn
=
false
;
}
}
private
void
OnCollisionExit2D
(
Collision2D
other
)
{
if
(
other
.
gameObject
.
layer
==
9
)
if
(
m_WhatIsGround
==
(
m_WhatIsGround
|
(
1
<<
other
.
gameObject
.
layer
)))
{
m_Airborn
=
true
;
}
}
...
...
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