<commit_before>﻿using UnityEngine;

public class PlayerHealthManager : MonoBehaviour {

    private const string LIVES_GAME_OBJ_NAME = "Remaining Lives";

    [SerializeField]
    private int remainingLives = 3;

    [SerializeField]
    private LevelManager levelManager;

    public void Start()
    {
        UpdateLivesComponent();
    }

    public int RemainingLives
    {
        get {return remainingLives;}
        set {remainingLives = value;}
    }

    public void LoseLife()
    {
        remainingLives--;
        if (!IsAlive())
            levelManager.GameOver();
        else
        {
            UpdateLivesComponent();
            GameObject.FindGameObjectWithTag("Player").SendMessage("ResetPosition");
        }
    }
    
    public void UpdateLivesComponent()
    {
        char fontAwesomeHealthSymbol = ''; //A heart symbol in the font-awesome font family
        UpdateRemainingLivesText(new string(fontAwesomeHealthSymbol, remainingLives));
    }

    private void UpdateRemainingLivesText(string newText)
    {
        GameObject.Find(LIVES_GAME_OBJ_NAME).GetComponent<UnityEngine.UI.Text>().text = newText;
    }

    public bool IsAlive()
    {
        return remainingLives > 0;
    }
}<commit_msg>Get player gameobject on first start of healthmanager<commit_after>﻿using UnityEngine;

public class PlayerHealthManager : MonoBehaviour {

    private const string LIVES_GAME_OBJ_NAME = "Remaining Lives";

    [SerializeField]
    private int remainingLives = 3;

    [SerializeField]
    private LevelManager levelManager;

    private GameObject objPlayer;

    public void Start()
    {
        objPlayer = GameObject.FindGameObjectWithTag("Player");
        UpdateLivesComponent();
    }

    public int RemainingLives
    {
        get {return remainingLives;}
        set {remainingLives = value;}
    }

    public void LoseLife()
    {
        remainingLives--;
        if (!IsAlive())
            levelManager.GameOver();
        else
        {
            UpdateLivesComponent();
            objPlayer.SendMessage("ResetPosition");
        }
    }
    
    public void UpdateLivesComponent()
    {
        char fontAwesomeHealthSymbol = ''; //A heart symbol in the font-awesome font family
        UpdateRemainingLivesText(new string(fontAwesomeHealthSymbol, remainingLives));
    }

    private void UpdateRemainingLivesText(string newText)
    {
        GameObject.Find(LIVES_GAME_OBJ_NAME).GetComponent<UnityEngine.UI.Text>().text = newText;
    }

    public bool IsAlive()
    {
        return remainingLives > 0;
    }
}
{'fraction_non_alphanumeric': 0.08521400778210117, 'fraction_numerical': 0.0015564202334630351, 'mean_word_length': 2.575799721835883, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4875525', 'n_tokens_mistral': 745, 'n_tokens_neox': 720, 'n_words': 158}