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

public class Player_Unitychan : MonoBehaviour {

	// Player
	public static Animator playerAnim;
	public static int playerHealth = 100;
	public static int playerStamina = 100;
	public static bool isPlayerHit;
	float forwardSpeed = 1.5f;
	float backwardSpeed = 1.0f;
	float rotateSpeed = 4.0f;
	float horizontal;
	float vertical;
	int idleAnimTime;


	// Use this for initialization
	void Start () {
		playerAnim = GetComponent<Animator> ();
	}
	
	// Update is called once per frame
	void Update () {
		// Stamina regen
		idleAnimTime++;
		if(playerStamina < 100){
			//playerStamina++;
		}
		else{
			playerAnim.SetInteger("Stamina", 100);
		}
		if(idleAnimTime > 1000){
			idleAnimTime = 0;
		}
		
		// Player hit and damaged
		if(isPlayerHit){
			playerAnim.SetBool("isDamaged", true);
			isPlayerHit = false;
			playerHealth -= 10;
			playerAnim.SetInteger("Health", playerHealth);
		}
		else{
			playerAnim.SetBool("isDamaged", false);
		}
		
		
		// Disable foot collider
		GameObject.Find ("CHARACTER FOOT").GetComponent<BoxCollider>().enabled = false;
		
		// Player jump
		if(Input.GetButton("Jump")){
			playerAnim.SetBool("isJumpPressed", true);
		}
		if(Input.GetButtonDown("Jump")){
			playerAnim.SetBool("isJumpPressed", true);
			playerStamina -= 50;
			playerAnim.SetInteger("Stamina", playerStamina);
		}
		if(Input.GetButtonUp("Jump")) {
			playerAnim.SetBool("isJumpPressed", false);
		}
		
		// Player attack
		if(Input.GetButton("Fire1")){
			playerAnim.SetBool("isAttacking", true);
			GameObject.Find ("CHARACTER FOOT").GetComponent<BoxCollider>().enabled = true;
		}<commit_msg>Update Animation<commit_after>﻿using UnityEngine;
using System.Collections;

public class Player_Unitychan : MonoBehaviour {

	// Player
	public static Animator playerAnim;
	public static int playerHealth = 100;
	public static int playerStamina = 100;
	public static bool isPlayerHit;
	float forwardSpeed = 1.5f;
	float backwardSpeed = 1.0f;
	float rotateSpeed = 4.0f;
	float horizontal;
	float vertical;
	int idleAnimTime;


	// Use this for initialization
	void Start () {
		playerAnim = GetComponent<Animator> ();
	}
	
	// Update is called once per frame
	void Update () {
		// Stamina regen
		idleAnimTime++;
		if(playerStamina < 100){
			//playerStamina++;
		}
		else{
			playerAnim.SetInteger("Stamina", 100);
		}
		if(idleAnimTime > 1000){
			idleAnimTime = 0;
		}
		
		// Player hit and damaged
		if(isPlayerHit){
			playerAnim.SetBool("isDamaged", true);
			isPlayerHit = false;
			playerHealth -= 10;
			playerAnim.SetInteger("Health", playerHealth);
		}
		else{
			playerAnim.SetBool("isDamaged", false);
		}



		// Checking animation playing
		int playerAnimHash = playerAnim.GetCurrentAnimatorStateInfo (0).nameHash;
		int attackHash = Animator.StringToHash ("Base Layer.Attack");
		int idleHash = Animator.StringToHash ("Base Layer.Idle");
		if(playerAnimHash == attackHash){
			print ("Player is attacking");
		}
		if(playerAnimHash == idleHash){
			print ("Player is idle");
		}


		// Disable foot collider
		GameObject.Find ("CHARACTER FOOT").GetComponent<BoxCollider>().enabled = false;
		
		// Player jump
		if(Input.GetButton("Jump")){
			playerAnim.SetBool("isJumpPressed", true);
		}
		if(Input.GetButtonDown("Jump")){
			playerAnim.SetBool("isJumpPressed", true);
			playerStamina -= 50;
			playerAnim.SetInteger("Stamina", playerStamina);
		}
		if(Input.GetButtonUp("Jump")) {
			playerAnim.SetBool("isJumpPressed", false);
		}
		
		// Player attack
		if(Input.GetButton("Fire1")){
			playerAnim.SetBool("isAttacking", true);
			GameObject.Find ("CHARACTER FOOT").GetComponent<BoxCollider>().enabled = true;
		}
{'fraction_non_alphanumeric': 0.129764801297648, 'fraction_numerical': 0.015409570154095702, 'mean_word_length': 4.0271739130434785, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1086207', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1224, 'n_words': 266}