Commit ca2169ad authored by Sebastian Frey's avatar Sebastian Frey

Merge remote-tracking branch 'origin/master'

parents cc0eebdb 20b16ac2
...@@ -22,6 +22,6 @@ public class InputController : MonoBehaviour { ...@@ -22,6 +22,6 @@ public class InputController : MonoBehaviour {
m_Jump = Input.GetKeyDown (KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W); 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 //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);
} }
} }
...@@ -112,12 +112,10 @@ public class MovementController : MonoBehaviour ...@@ -112,12 +112,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);
...@@ -246,14 +244,19 @@ public class MovementController : MonoBehaviour ...@@ -246,14 +244,19 @@ 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;
}
} }
......
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