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

[RequireComponent(typeof(Hero))]
public class HeroFX : CustomBehaviour {

	public enum Direction { Left, Right }
	
	public SpriteRenderer fx;
	public Sprite jumpySprite;
	internal Sprite idleSprite;
	internal Transform xform;
	internal Hero hero;
	
	internal float animationTime;
	internal Direction direction = Direction.Right;
	
	void Awake() {
		xform = fx.transform;
		idleSprite = fx.sprite;
		hero = GetComponent<Hero>();
	}
	
	public void SetDirection(Direction dir) {
		if (direction != dir) {
			direction = dir;
			xform.localScale = Vec(dir == Direction.Left ? -1 : 1, 1, 1);
		}
	}
	
	void Update() {
	
		if (hero.grounded) {
			var speed = Mathf.Abs (hero.body.velocity.x);
			if (speed > 0.02f) {
				animationTime += speed * Time.deltaTime;
				var spr =  Mathf.FloorToInt(2 * animationTime) % 2 == 0 ? idleSprite : jumpySprite;
				if (fx.sprite != spr) {
					fx.sprite = spr;
					if (spr == idleSprite) {
						Jukebox.Play("Footfall");
					}
				}
				
			} else {
				animationTime = 0f;
				if (fx.sprite != idleSprite) {
					fx.sprite = idleSprite;
					Jukebox.Play("Footfall");
				}
			}
		} else {
			animationTime = 0f;
			fx.sprite = jumpySprite;			
		}
	}
	
	public void Flash(Color c, float duration = 1f) {
		StartCoroutine(DoFlash(c, duration));
	}
	
	IEnumerator DoFlash(Color c, float duration) {
		foreach(var u in Interpolate(duration)) {
			fx.color = RGBA(c, 1f-EaseOut2(u));
			yield return null;
		}
	}
	

	

}
<commit_msg>saving fx<commit_after>﻿using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Hero))]
public class HeroFX : CustomBehaviour {

	public enum Direction { Left, Right }
	
	public SpriteRenderer fx;
	public Sprite jumpySprite;
	internal Sprite idleSprite;
	internal Transform xform;
	internal Hero hero;
	
	
	
	internal float animationTime;
	internal Direction direction = Direction.Right;
	
	void Awake() {
		xform = fx.transform;
		idleSprite = fx.sprite;
		hero = GetComponent<Hero>();
	}
	
	public void SetDirection(Direction dir) {
		if (direction != dir) {
			direction = dir;
			xform.localScale = Vec(dir == Direction.Left ? -1 : 1, 1, 1);
		}
	}
	
	void Update() {
	
		if (hero.grounded) {
			var speed = Mathf.Abs (hero.body.velocity.x);
			if (speed > 0.02f) {
				animationTime += speed * Time.deltaTime;
				var spr =  Mathf.FloorToInt(2 * animationTime) % 2 == 0 ? idleSprite : jumpySprite;
				if (fx.sprite != spr) {
					fx.sprite = spr;
					if (spr == idleSprite) {
						Jukebox.Play("Footfall");
					}
				}
				
			} else {
				animationTime = 0f;
				if (fx.sprite != idleSprite) {
					fx.sprite = idleSprite;
					Jukebox.Play("Footfall");
				}
			}
		} else {
			animationTime = 0f;
			fx.sprite = jumpySprite;			
		}
	}
	
	public void Flash(Color c, float duration = 1f) {
		StartCoroutine(DoFlash(c, duration));
	}
	
	IEnumerator DoFlash(Color c, float duration) {
		foreach(var u in Interpolate(duration)) {
			fx.color = RGBA(c, 1f-EaseOut2(u));
			yield return null;
		}
	}
	

	

}

{'fraction_non_alphanumeric': 0.1243455497382199, 'fraction_numerical': 0.00981675392670157, 'mean_word_length': 3.0118110236220472, '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': '778214', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1092, 'n_words': 259}