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

public class RigidbodySleepCheck : MonoBehaviour {

  private Rigidbody rb;
  private bool knockedOver;
  private int points;
  private HUDManager hudManager;
  private float threshold;
  private string sceneName;
  private string objName;

	private void Start () {

    objName = gameObject.name;

    if (objName.LastIndexOf(" ") > 0) {
      objName = objName.Substring(0, objName.LastIndexOf(" "));
    }

    if (DataManager.ObjectMovementThreshold == 0) {
      DataManager.ObjectMovementThreshold = 1;
    }
    threshold = DataManager.ObjectMovementThreshold;
    knockedOver = false;
    rb = GetComponent<Rigidbody>();
    hudManager = FindObjectOfType (typeof (HUDManager)) as HUDManager;

    sceneName = SceneManager.GetActiveScene().name;

    int _mass = 0;
    int _points = 0;
    int i = 0;

    List<ObjectData> ObjectProperties = DataManager.ObjectProperties;

    while (_mass == 0 && i < ObjectProperties.Count) {
      if (ObjectProperties[i].name == objName) {
        _mass = ObjectProperties[i].mass;
        _points = ObjectProperties[i].points;
      }
      i++;
    }

    Debug.Log (objName + " volume: " + VolumeOfMesh(GetComponent<MeshFilter>().mesh));

    rb.mass = (_mass != 0) ? _mass : 1;
    points = (_points != 0) ? _points : 1;
	}
	
	private void OnCollisionStay (Collision other) {
    if (other.gameObject.GetComponent<Rigidbody>() != null && rb != null) {
      if (!knockedOver) {
    		if (rb.velocity.magnitude > 2) {
          knockedOver = true;
          Renderer rend = null;
          if (GetComponent<Renderer>() != null) {
            rend = GetComponent<Renderer>();
            rend.material.color = new Color(0.8F, 0.8F, 0.8F, 1F);;
          }

          int _points = points;

          // _points *= DataManager.Combo;

          DataManager.Score += _points;
          DataManager.CumulativeScore += _points;<commit_msg>trying to fix errors delton is having<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class RigidbodySleepCheck : MonoBehaviour {

  private Rigidbody rb;
  private bool knockedOver;
  private int points;
  private HUDManager hudManager;
  private float threshold;
  private string sceneName;
  private string objName;

	private void Start () {

    objName = gameObject.name;

    if (objName.LastIndexOf(" ") > 0) {
      objName = objName.Substring(0, objName.LastIndexOf(" "));
    }

    if (DataManager.ObjectMovementThreshold == 0) {
      DataManager.ObjectMovementThreshold = 1;
    }
    threshold = DataManager.ObjectMovementThreshold;
    knockedOver = false;
    rb = GetComponent<Rigidbody>();
    hudManager = FindObjectOfType (typeof (HUDManager)) as HUDManager;

    sceneName = SceneManager.GetActiveScene().name;

    int _mass = 0;
    int _points = 0;
    int i = 0;

    List<ObjectData> ObjectProperties = DataManager.ObjectProperties;

    while (_mass == 0 && i < ObjectProperties.Count) {
      if (ObjectProperties[i].name == objName) {
        _mass = ObjectProperties[i].mass;
        _points = ObjectProperties[i].points;
      }
      i++;
    }

    float volume = VolumeOfMesh(GetComponent<MeshFilter>().mesh);

    volume *= ((transform.localScale.x + transform.localScale.y + transform.localScale.z) / 3);

    Debug.Log (objName + " volume: " + volume);

    rb.mass = (_mass != 0) ? _mass : 1;
    points = (_points != 0) ? _points : 1;
	}
	
	private void OnCollisionStay (Collision other) {
    if (other.gameObject.GetComponent<Rigidbody>() != null && rb != null) {
      if (!knockedOver) {
    		if (rb.velocity.magnitude > 2) {
          knockedOver = true;
          Renderer rend = null;
          if (GetComponent<Renderer>() != null) {
            rend = GetComponent<Renderer>();
            rend.material.color = new Color(0.8F, 0.8F, 0.8F, 1F);;
          }

          int _points = points;

          // _points *= DataManager.Combo;

          DataManager.Score += _points;
          DataManager.CumulativeScore += _points;
{'fraction_non_alphanumeric': 0.11688622754491018, 'fraction_numerical': 0.009820359281437126, 'mean_word_length': 2.8846511627906977, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '4324230', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1241, 'n_words': 297}