<commit_before>﻿using UnityEngine;
using System.Collections;

public class StaminaBody : MonoBehaviour
{

    public RaggedySpineboy player;
    public bool isLeftHand = false;
    public bool isRightHand = false;
    public bool isHead = false;
    public bool isLeftFoot = false;
    public bool isRightFoot = false;
    HingeJoint2D joint;
    StaminaBarScript stamina;
    Rigidbody2D rb;

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (stamina == null)
        {
            stamina = player.StaminaBar.GetComponent<StaminaBarScript>();
        }
        if (rb == null)
        {
            rb = GetComponent<Rigidbody2D>();
        }
        if (stamina.Health > 0 && !stamina.Regening)
        {

            if (coll.gameObject.layer == 31)
            {
                float collisionForce = coll.rigidbody.velocity.magnitude;
                rb.AddForce(coll.relativeVelocity / stamina.Health);
                stamina.DecreaseBar(collisionForce / 5f);
            }
            else
            {
                float collisionForce = rb.velocity.magnitude;
                if (collisionForce > 10f)
                {
                    stamina.DecreaseBar(collisionForce / 5f);

                }
                player.touchingGround = true;
                if (isLeftFoot)
                {
                    player.leftGrounded = true;
                }
                else if (isRightFoot)
                {
                    player.rightGrounded = true;
                }
            }
        }
    }

    void OnCollisionStay2D(Collision2D coll)
    {
        if (coll.gameObject.tag.Contains("Player"))
        {
            if (joint.enabled = false && isLeftHand && Input.GetAxis("LeftTrigger" + ((int)player.player2).ToString()) > .1f)
            {
                joint = this.gameObject.AddComponent<HingeJoint2D>();
                joint.enabled = true;
                joint.connectedBody = coll.rigidbody;
            }
            if (joint.enabled == false && isRightHand && Input.GetAxis("RightTrigger" + ((int)player.player).ToString()) > .1f)
            {
                joint = this.gameObject.AddComponent<HingeJoint2D>();
                joint.enabled = true;
                joint.connectedBody = coll.rigidbody;
            }
        }
        else
        {
            player.touchingGround = true;
            if (isLeftFoot)
            {
                player.leftGrounded = true;
            }
            else if (isRightFoot)
            {
                player.rightGrounded = true;
            }
        }
    }

    // Use this for initialization
    void OnCollisionExit2D(Collision2D coll)
    {
        if (!coll.gameObject.tag.Contains("Player"))
        {
            player.touchingGround = false;
            if (isLeftFoot)
            {
                player.leftGrounded = false;
            }
            else if (isRightFoot)
            {
                player.rightGrounded = false;
            }
        }
    }

    // Use this for initialization
    void Start()
    {
        joint = gameObject.AddComponent<HingeJoint2D>();
        joint.autoConfigureConnectedAnchor = true;
        joint.enabled = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (stamina.Health == 0)
        {
            joint.connectedBody = null;
            joint.enabled = false;
        }
        if (joint.enabled == true && isLeftHand && Input.GetAxis("LeftTrigger" + ((int)player.player2).ToString()) <= .1f)
        {
            Destroy(joint);
            joint = null;
            joint.connectedBody = null;
            joint.enabled = false;
        }
        if (joint.enabled == true && isRightHand && Input.GetAxis("RightTrigger" + ((int)player.player).ToString()) <= .1f)
        {<commit_msg>dffas<commit_after>﻿using UnityEngine;
using System.Collections;

public class StaminaBody : MonoBehaviour
{

    public RaggedySpineboy player;
    public bool isLeftHand = false;
    public bool isRightHand = false;
    public bool isHead = false;
    public bool isLeftFoot = false;
    public bool isRightFoot = false;
    HingeJoint2D joint;
    StaminaBarScript stamina;
    Rigidbody2D rb;

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (stamina == null)
        {
            stamina = player.StaminaBar.GetComponent<StaminaBarScript>();
        }
        if (rb == null)
        {
            rb = GetComponent<Rigidbody2D>();
        }
        if (stamina.Health > 0 && !stamina.Regening)
        {

            if (coll.gameObject.layer == 31)
            {
                float collisionForce = coll.rigidbody.velocity.magnitude;
                rb.AddForce(coll.relativeVelocity / stamina.Health);
                stamina.DecreaseBar(collisionForce / 5f);
            }
            else
            {
                float collisionForce = rb.velocity.magnitude;
                if (collisionForce > 10f)
                {
                    stamina.DecreaseBar(collisionForce / 5f);

                }
                player.touchingGround = true;
                if (isLeftFoot)
                {
                    player.leftGrounded = true;
                }
                else if (isRightFoot)
                {
                    player.rightGrounded = true;
                }
            }
        }
    }

    void OnCollisionStay2D(Collision2D coll)
    {
        if (coll.gameObject.tag.Contains("Player"))
        {
            if (joint.enabled = false && isLeftHand && Input.GetAxis("LeftTrigger" + ((int)player.player2).ToString()) > .1f)
            {
                joint = this.gameObject.AddComponent<HingeJoint2D>();
                joint.enabled = true;
                joint.connectedBody = coll.rigidbody;
            }
            if (joint.enabled == false && isRightHand && Input.GetAxis("RightTrigger" + ((int)player.player).ToString()) > .1f)
            {
                joint = this.gameObject.AddComponent<HingeJoint2D>();
                joint.enabled = true;
                joint.connectedBody = coll.rigidbody;
            }
        }
        else
        {
            player.touchingGround = true;
            if (isLeftFoot)
            {
                player.leftGrounded = true;
            }
            else if (isRightFoot)
            {
                player.rightGrounded = true;
            }
        }
    }

    // Use this for initialization
    void OnCollisionExit2D(Collision2D coll)
    {
        if (!coll.gameObject.tag.Contains("Player"))
        {
            player.touchingGround = false;
            if (isLeftFoot)
            {
                player.leftGrounded = false;
            }
            else if (isRightFoot)
            {
                player.rightGrounded = false;
            }
        }
    }

    // Use this for initialization
    void Start()
    {
        joint = gameObject.AddComponent<HingeJoint2D>();
        joint.autoConfigureConnectedAnchor = true;
        joint.enabled = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (stamina == null)
        {
            stamina = player.StaminaBar.GetComponent<StaminaBarScript>();
        }
        if (rb == null)
        {
            rb = GetComponent<Rigidbody2D>();
        }
        if (stamina.Health == 0)
        {
            joint.connectedBody = null;
            joint.enabled = false;
        }
        if (joint.enabled == true && isLeftHand && Input.GetAxis("LeftTrigger" + ((int)player.player2).ToString()) <= .1f)
        {
            Destroy(joint);
            joint = null;
            joint.connectedBody = null;
            joint.enabled = false;
        }
        if (joint.enabled == true && isRightHand && Input.GetAxis("RightTrigger" + ((int)player.player).ToString()) <= .1f)
        {
{'fraction_non_alphanumeric': 0.09909565660425423, 'fraction_numerical': 0.006750732390778245, 'mean_word_length': 1.406374501992032, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, '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': '6635698', 'n_tokens_mistral': 2246, 'n_tokens_neox': 2138, 'n_words': 400}