<commit_before>using UnityEngine;

/// <summary>
/// This script needs to be attached to the camera.
/// It makes the camera move on Y axis until the player is located at center of screen or a desired location.
/// </summary>
public class LockYWhenPlayerOnTarget : MonoBehaviour {

	private float origTimeFactor;
	private PlayerFollowerXYConfig origFollower;
	private Player player;
	
	void Awake () {
		origFollower = GetComponent<PlayerFollowerXYConfig>();
		this.enabled = false;
	}
	
	void OnDestroy () {
		player = null;
		origFollower = null;
	}
	
	/**
	 * LateUpdate is called after all Update functions have been called.
	 * Dependant objects might have moved during Update.
	 */
	void LateUpdate () {
		int screenPosY = (int)(Camera.main.WorldToScreenPoint(player.transform.position).y + 0.5f);
		if (player.isDying() || (!player.isJumping() && (screenPosY + origFollower.offsetY) == (Screen.height / 2))) {
			this.enabled = false;
			restoreConfig();
		}
	}
	
	private void restoreConfig () {
		// restore Main Camera's follower script configuration
		origFollower.lockY = true;
		origFollower.timeFactor = origTimeFactor;
	}
	
	public void correctPosY () {
		// copy current Main Camera configuration
		origTimeFactor = origFollower.timeFactor;
		// set new Main Camera's follower script configuration according to the effect we want to achieve
		origFollower.lockY = false; // follow the player
		origFollower.timeFactor *= 2.5f; // speed up the correction
		
		player = LevelManager.Instance.getPlayer();
		this.enabled = true;
	}
}<commit_msg>Using delta value for Player position in screen<commit_after>using UnityEngine;

/// <summary>
/// This script needs to be attached to the camera.
/// It makes the camera move on Y axis until the player is located at center of screen or a desired location.
/// </summary>
public class LockYWhenPlayerOnTarget : MonoBehaviour {

	private float origTimeFactor;
	private PlayerFollowerXYConfig origFollower;
	private Player player;
	
	void Awake () {
		origFollower = GetComponent<PlayerFollowerXYConfig>();
		this.enabled = false;
	}
	
	void OnDestroy () {
		player = null;
		origFollower = null;
	}
	
	/**
	 * LateUpdate is called after all Update functions have been called.
	 * Dependant objects might have moved during Update.
	 */
	void LateUpdate () {
		float screenPosY = Camera.main.WorldToScreenPoint(player.transform.position).y;
		float diff = Mathf.Abs(screenPosY - (Screen.height / 2));
		if (player.isDying() || (!player.isJumping() && diff < 2f)) {
			this.enabled = false;
			restoreConfig();
		}
	}
	
	private void restoreConfig () {
		// restore Main Camera's follower script configuration
		origFollower.lockY = true;
		origFollower.timeFactor = origTimeFactor;
	}
	
	public void correctPosY () {
		// copy current Main Camera configuration
		origTimeFactor = origFollower.timeFactor;
		// set new Main Camera's follower script configuration according to the effect we want to achieve
		origFollower.lockY = false; // follow the player
		origFollower.timeFactor *= 2.5f; // speed up the correction
		
		player = LevelManager.Instance.getPlayer();
		this.enabled = true;
	}
}
{'fraction_non_alphanumeric': 0.09812638932994601, 'fraction_numerical': 0.0028580501746586218, 'mean_word_length': 3.801829268292683, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2973258', 'n_tokens_mistral': 998, 'n_tokens_neox': 878, 'n_words': 299}