Beispiel #1
0
 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>();
 }
Beispiel #2
0
    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>();
    }