How to detect if GameObject did a 360° flip in 2D.

Hey guys,
I am beginer with Unity and I am making a 2D game . So I was adding some feautures on the game and one of them is the “Flips”, the game count the flips the Player did in air and show them in the UI. The problem is that I dont know how to detect if the car did a whole flip. If anyone help I’ll appreciate it. Thanks.
This is the code of the player movements:

``````using UnityEngine.SceneManagement;
using UnityEngine;
using System.Collections;

public class RiderController : MonoBehaviour {

public Rigidbody2D rb;
public float speed = 10f;
public float rotationSpeed = 2f;

private bool move = false;
private static bool isGrounded = false;
private bool start = true;
private float upsideDown = 0f;

void Update () {

if (Input.GetButtonDown("Fire1"))
{
move = true;
}

if(Input.GetButtonUp("Fire1"))
{
move = false;
}
}

private void FixedUpdate()
{
upsideDown = Vector2.Dot(transform.up, Vector2.down);
if (isGrounded && (upsideDown > 0)) //to check if the player is upside down
{
StartCoroutine(RestartLevel());
}

if (move)
{
if (isGrounded)
rb.AddForce(transform.right * speed * Time.fixedDeltaTime * 100f, ForceMode2D.Force);

else
rb.AddTorque(rotationSpeed * Time.fixedDeltaTime * 100f, ForceMode2D.Force);

}
}

private void OnCollisionEnter2D(Collision2D collision)
{
foreach (ContactPoint2D contact in collision.contacts)
{
if (contact.collider.tag.Equals("Line") && !contact.collider.tag.Equals("Start"))
{
isGrounded = true;
start = false;
}

else if(contact.collider.tag.Equals("Start"))
{
isGrounded = true;
start = true;
}
}
}

private void OnCollisionExit2D()
{
if(!start)
isGrounded = false;
}

IEnumerator RestartLevel()
{
yield return new WaitForSeconds(1f);
if (isGrounded && (upsideDown > 0))
}

public static bool GetisGrounded()
{
return isGrounded;
}
}
``````

in the update check to see what the rotation is and compare that to the original ex. new = 425 og =0

425 - 0 = 425 / 360 = 1 flip (1.18 but im assuming you would round to closest integer)

Here’s the new code :
Ps : with some tests I could found the right values for zmin and zmax

``````private void CountFlips()
{
if ((transform.rotation.eulerAngles.z > zmin) && (transform.rotation.eulerAngles.z < zmax))
{
flipsAmount++;
}

}
``````