Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Suck It
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GameDevWeek
W
Wintersemester 2018-2019
Unity
Suck It
Commits
20b16ac2
Commit
20b16ac2
authored
Mar 29, 2019
by
Unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
want some
parent
2dbbfb61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Assets/_Game/Scripts/Player/MovementController.cs
Assets/_Game/Scripts/Player/MovementController.cs
+7
-4
No files found.
Assets/_Game/Scripts/Player/MovementController.cs
View file @
20b16ac2
...
...
@@ -111,12 +111,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
);
...
...
@@ -245,14 +243,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