void OnCollisionStay2D(Collision2D coll) { canJump = true; timeStayedOnPlatform += Time.fixedDeltaTime; timeBeforeDrop = Time.time - SimulationManager.sLastGenTime; travelDist = transform.position.x; // Distance only count if the square is touching the platform currentPlatform = coll.gameObject.GetComponent <MakeNextPlatform>(); }
void OnCollisionEnter2D(Collision2D coll) { canJump = true; if (currentPlatform != null && coll.gameObject != currentPlatform.gameObject) // If the square landed on a new platform { travelPlat++; } currentPlatform = coll.gameObject.GetComponent <MakeNextPlatform>(); }