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

public class InputManager : SingletonMonoBehaviour<InputManager> {
	public float LittleX { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Left.X; } }
	public float LittleY { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Left.Y; } }
	public ButtonState LittleThrow { get { return GamePad.GetState( PlayerIndex.One ).Buttons.LeftShoulder; } }
	public float BigX { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Right.X; } }
	public float BigY { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Right.Y; } }
	public ButtonState BigThrow { get { return GamePad.GetState( PlayerIndex.One ).Buttons.RightShoulder; } }

	private bool LittleThrowPressedThisFrame;
	private bool BigThrowPressedThisFrame;

	public Vector2 GetMovement (ClownId clownId) {
		switch (clownId) {
			case ClownId.Little:
				return new Vector2( LittleX, LittleY );
			case ClownId.Big:
				return new Vector2( BigX, BigY );
			default:
				throw new System.InvalidOperationException();
		}
	}

	public bool WasThrowPressedThisFrame (ClownId clownId) {
		switch (clownId) {
			case ClownId.Little:
				return LittleThrowPressedThisFrame;
			case ClownId.Big:
				return BigThrowPressedThisFrame;
			default:
				throw new System.InvalidOperationException();
		}
	}

	void Update() {
		if (!LittleThrowPressedThisFrame && LittleThrow == ButtonState.Pressed) {
			LittleThrowPressedThisFrame = true;
		}
		else {
			LittleThrowPressedThisFrame = false;
		}

		if (!BigThrowPressedThisFrame && BigThrow == ButtonState.Pressed) {
			BigThrowPressedThisFrame = true;
		}
		else {
			BigThrowPressedThisFrame = false;
		}

	}
}
<commit_msg>fixed bug in InputManager throw button detection<commit_after>﻿using UnityEngine;
using System.Collections;
using XInputDotNetPure;

public class InputManager : SingletonMonoBehaviour<InputManager> {
	public float LittleX { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Left.X; } }
	public float LittleY { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Left.Y; } }
	public ButtonState LittleThrow { get { return GamePad.GetState( PlayerIndex.One ).Buttons.LeftShoulder; } }
	public float BigX { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Right.X; } }
	public float BigY { get { return GamePad.GetState( PlayerIndex.One ).ThumbSticks.Right.Y; } }
	public ButtonState BigThrow { get { return GamePad.GetState( PlayerIndex.One ).Buttons.RightShoulder; } }

	private ButtonState LittleThrowLastFrame;
	private ButtonState BigThrowLastFrame;
	private bool LittleThrowPressedThisFrame;
	private bool BigThrowPressedThisFrame;

	public Vector2 GetMovement (ClownId clownId) {
		switch (clownId) {
			case ClownId.Little:
				return new Vector2( LittleX, LittleY );
			case ClownId.Big:
				return new Vector2( BigX, BigY );
			default:
				throw new System.InvalidOperationException();
		}
	}

	public bool WasThrowPressedThisFrame (ClownId clownId) {
		switch (clownId) {
			case ClownId.Little:
				return LittleThrowPressedThisFrame;
			case ClownId.Big:
				return BigThrowPressedThisFrame;
			default:
				throw new System.InvalidOperationException();
		}
	}

	void Update() {
		if (LittleThrowLastFrame == ButtonState.Released && LittleThrow == ButtonState.Pressed) {
			LittleThrowPressedThisFrame = true;
		}
		else {
			LittleThrowPressedThisFrame = false;
		}
		LittleThrowLastFrame = LittleThrow;

		if (BigThrowLastFrame == ButtonState.Released && BigThrow == ButtonState.Pressed) {
			BigThrowPressedThisFrame = true;
		}
		else {
			BigThrowPressedThisFrame = false;
		}
		BigThrowLastFrame = BigThrow;
	}
}

{'fraction_non_alphanumeric': 0.09176788124156546, 'fraction_numerical': 0.0016194331983805667, 'mean_word_length': 4.547904191616767, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5882582', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1155, 'n_words': 274}