Commit 20b16ac2 authored by Unknown's avatar Unknown

want some

parent 2dbbfb61
......@@ -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;
}
}
......
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