i am making code for camera following the player which moves in both x and z direction like in temple run.. but camera stops following when euler angle is 180

temp_vec = cam.transform.position;
temp_vec.y = 2;

		if( (this.gameObject.transform.eulerAngles.y == 0) ){   // if gimo's rotation angle is 0 then follow it in z

			temp = gimo.transform.position.z;
			temp_vec.z = temp - 5f;
			//temp_vec.x += 4;
			cam.transform.position = temp_vec;
			print("here .............. 0");

		}
		print ("euler angles........before..........^^"+ this.gameObject.transform.eulerAngles.y);
		 if( (this.gameObject.transform.eulerAngles.y == x) ){
			temp = gimo.transform.position.z;
			temp_vec.z = temp + 5f;
			//temp_vec.x += 4;
			cam.transform.position = temp_vec;
			print("here .............. 180");

		}
		print ("euler angles.......after...........^^"+ this.gameObject.transform.eulerAngles.y);
		if((this.gameObject.transform.eulerAngles == new Vector3(0.0f,90.0f,0.0f))){   // else follow it in x

			temp_x = gimo.transform.position.x;
			temp_vec.x = temp_x - 5 ;
			//temp_vec.z += 4;
			cam.transform.position = temp_vec;
			print("here .............. free");

		} 
 this is camera follow code. when player rotate 180, the camera rotates but stop following it in z???? don't getting it.. Please help..

Don’t know what temple run does, but of a camera follower this should do:

cam.transform.position = transform.forward * -5 + Vector3.up * 2;