I’m bulding a top down scroller, once the player collide with certain object the camera flip 180 degrees around the Z axis, now, i want the fliped screen only for limted time lets say 3 seconds, and after that the screen will flip in another 180 degress around the Z axis to bring the player back to the noraml view, something is wrong with my implemntation, help me please
void OnTriggerEnter(Collider col)
{
Destroy(gameObject);
if (col.gameObject.tag == "Player")
{
GameObject.FindGameObjectWithTag("MainCamera").transform.Rotate(new Vector3(0f, 0f, 180f));
do
{
flipScreenTimer += Time.deltaTime;
} while (flipScreenTimer < 3.0f);
GameObject.FindGameObjectWithTag("MainCamera").transform.Rotate(new Vector3(0f, 0f, 180f));
flipScreenTimer = 0f;
}