<commit_before>using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Jolly;

public class ScoreKeeper : MonoBehaviour
{
	public float TimeToWin;
	public Hero WinningHero;
	public Hero HeroAboutToWin;
	public GameObject HeroAboutToWinSound;
	public GameObject GameWonSound;

	Hero FindWinningPlayer()
	{
		return null;
	}

	void StartHeroAboutToWinSound(Hero hero)
	{
		SoundFX.Instance.StopMusic();
		this.HeroAboutToWinSound = SoundFX.Instance.OnHeroAboutToWin(hero);
	}

	void StopHeroAboutToWinSound()
	{
		SoundFX.Instance.StartMusic();
		AudioSourceExt.StopClipOnObject(this.HeroAboutToWinSound);
		Destroy(this.HeroAboutToWinSound);
	}

	void PlayVictorySound(Hero hero)
	{
		this.GameWonSound = SoundFX.Instance.OnMatchWon(hero);
		SoundFX.Instance.StopMusic();
	}

	void StopVictorySound()
	{
		AudioSourceExt.StopClipOnObject(this.GameWonSound);
		Destroy(this.GameWonSound);
	}

	void Update()
	{
		
	}

	public void ResetGame()
	{
		this.StopHeroAboutToWinSound();
		this.StopVictorySound();
		SoundFX.Instance.StartMusic();
		this.WinningHero = null;
		this.HeroAboutToWin = null;

		Hero[] heroes = FindObjectsOfType(typeof(Hero)) as Hero[];
	}
}
<commit_msg>added correct victory testing<commit_after>using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Jolly;

public class ScoreKeeper : MonoBehaviour
{
	public float TimeToWin;
	public Hero WinningHero;
	public Hero HeroAboutToWin;
	public GameObject HeroAboutToWinSound;
	public GameObject GameWonSound;
	
	Hero FindWinningPlayer()
	{
		List<Hero> livingPlayers = new List<Hero>();
		
		Hero[] heroes = FindObjectsOfType(typeof(Hero)) as Hero[];
		foreach (Hero hero in heroes) {
			if (hero.IsAlive) {
				livingPlayers.Add(hero);
			}
		}
		if (livingPlayers.Count == 1)
		{
			return livingPlayers[0];
		}
		
		return null;
	}
	
	void StartHeroAboutToWinSound(Hero hero)
	{
		SoundFX.Instance.StopMusic();
		this.HeroAboutToWinSound = SoundFX.Instance.OnHeroAboutToWin(hero);
	}
	
	void StopHeroAboutToWinSound()
	{
		SoundFX.Instance.StartMusic();
		AudioSourceExt.StopClipOnObject(this.HeroAboutToWinSound);
		Destroy(this.HeroAboutToWinSound);
	}
	
	void PlayVictorySound(Hero hero)
	{
		this.GameWonSound = SoundFX.Instance.OnMatchWon(hero);
		SoundFX.Instance.StopMusic();
	}
	
	void StopVictorySound()
	{
		AudioSourceExt.StopClipOnObject(this.GameWonSound);
		Destroy(this.GameWonSound);
	}
	
	void Update()
	{
		
		if (this.WinningHero != null)
		{
			return;
		}
		
		Hero hero = this.FindWinningPlayer();
		if (hero != null) {
			this.WinningHero = hero;
			this.PlayVictorySound(this.WinningHero);
		}
	}
	
	public void ResetGame()
	{
		this.StopHeroAboutToWinSound();
		this.StopVictorySound();
		SoundFX.Instance.StartMusic();
		this.WinningHero = null;
		this.HeroAboutToWin = null;
		
		Hero[] heroes = FindObjectsOfType(typeof(Hero)) as Hero[];
	}
}

{'fraction_non_alphanumeric': 0.10792349726775956, 'fraction_numerical': 0.0006830601092896175, 'mean_word_length': 4.743137254901961, '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': '7460111', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1035, 'n_words': 180}