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

[System.Serializable]
public class UnityEvent_float : UnityEvent <float> {}




public class GotoNextScene : MonoBehaviour {

	[InspectorButton("GotoNextScene")]
	public bool		_GotoNextScene;

	[Header("If not zero, go to next scene after X secs from OnEnable")]
	[Range(0,180)]
	public float	TriggerAfterSecs = 0;
	public bool		DoTimedTrigger
	{
		get
		{
			return TriggerAfterSecs > 0;
		}
	}
	private float	TriggerFromTime = 0;

	[Header("sends 0-1 of countdown")]
	public UnityEvent_float	OnCountdown;

	public void NextScene()
	{
		//	see if there's a scene controller
		var sc = GameObject.FindObjectOfType<SceneOrderController>();
		if (sc != null) {
			sc.NextScene ();
			return;
		}
		
		var CurrentScene = SceneManager.GetActiveScene();
		var CurrentSceneIndex = CurrentScene.buildIndex;
		var NextSceneIndex = (CurrentSceneIndex + 1) % SceneManager.sceneCountInBuildSettings;

		SceneManager.LoadScene(NextSceneIndex, LoadSceneMode.Single);
	}

	void OnEnable()
	{
		TriggerFromTime = Time.time;
	}

	void Update () {

		if (DoTimedTrigger) {
			var TimeSinceStart = Time.time - TriggerFromTime;
			var CountdownFactor = Mathf.Clamp01 (TimeSinceStart / TriggerAfterSecs);
			//Debug.Log (CountdownFactor);
			OnCountdown.Invoke (CountdownFactor);
				if ( TimeSinceStart> TriggerAfterSecs) {
					NextScene ();
			}
		}
	}
}<commit_msg>Added a mouseclick-to-skip global option for GotoNextScene<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Events;

[System.Serializable]
public class UnityEvent_float : UnityEvent <float> {}




public class GotoNextScene : MonoBehaviour {

	[InspectorButton("GotoNextScene")]
	public bool		_GotoNextScene;

	[Header("If not zero, go to next scene after X secs from OnEnable")]
	[Range(0,180)]
	public float	TriggerAfterSecs = 0;
	public bool		DoTimedTrigger
	{
		get
		{
			return TriggerAfterSecs > 0;
		}
	}
	private float	TriggerFromTime = 0;

	[Header("sends 0-1 of countdown")]
	public UnityEvent_float	OnCountdown;

	public bool SkipOnMouseClick = false;

	public void NextScene()
	{
		//	see if there's a scene controller
		var sc = GameObject.FindObjectOfType<SceneOrderController>();
		if (sc != null) {
			sc.NextScene ();
			return;
		}
		
		var CurrentScene = SceneManager.GetActiveScene();
		var CurrentSceneIndex = CurrentScene.buildIndex;
		var NextSceneIndex = (CurrentSceneIndex + 1) % SceneManager.sceneCountInBuildSettings;

		SceneManager.LoadScene(NextSceneIndex, LoadSceneMode.Single);
	}

	void OnEnable()
	{
		TriggerFromTime = Time.time;
	}

	void Update () {

		if (SkipOnMouseClick) {
			if (Input.GetMouseButtonDown (0)) {
				NextScene ();
			}
		}

		if (DoTimedTrigger) {
			var TimeSinceStart = Time.time - TriggerFromTime;
			var CountdownFactor = Mathf.Clamp01 (TimeSinceStart / TriggerAfterSecs);
			//Debug.Log (CountdownFactor);
			OnCountdown.Invoke (CountdownFactor);
				if ( TimeSinceStart> TriggerAfterSecs) {
					NextScene ();
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.10031347962382445, 'fraction_numerical': 0.007836990595611285, 'mean_word_length': 4.345058626465661, 'pattern_counts': {'":': 0, '<': 7, '<?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': '571117', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1019, 'n_words': 244}