Commit 20b16ac2 authored by Unknown's avatar Unknown
Browse files

want some

parent 2dbbfb61
...@@ -111,12 +111,10 @@ public class MovementController : MonoBehaviour ...@@ -111,12 +111,10 @@ public class MovementController : MonoBehaviour
public void Move(Vector2 move, bool jump) public void Move(Vector2 move, bool jump)
{ {
m_Movement = move; m_Movement = move;
//only control the player if grounded or airControl is turned on //only control the player if grounded or airControl is turned on
if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim)) if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim))
{ {
// Move the character by finding the target velocity // Move the character by finding the target velocity
Vector2 targetVelocity = new Vector2((move.x * m_Speed * Time.deltaTime) * 10f, m_Rigidbody2D.velocity.y); Vector2 targetVelocity = new Vector2((move.x * m_Speed * Time.deltaTime) * 10f, m_Rigidbody2D.velocity.y);
...@@ -245,16 +243,21 @@ public class MovementController : MonoBehaviour ...@@ -245,16 +243,21 @@ public class MovementController : MonoBehaviour
private void OnCollisionEnter2D(Collision2D other) private void OnCollisionEnter2D(Collision2D other)
{ {
if (other.gameObject.layer == 9) if (m_WhatIsGround == (m_WhatIsGround | (1 << other.gameObject.layer))){
m_Airborn = false; m_Airborn = false;
} }
}
private void OnCollisionExit2D(Collision2D other) private void OnCollisionExit2D(Collision2D other)
{ {
if (other.gameObject.layer == 9) if (m_WhatIsGround == (m_WhatIsGround | (1 << other.gameObject.layer)))
{
m_Airborn = true; m_Airborn = true;
} }
}
void OnDrawGizmos() void OnDrawGizmos()
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment