//Copyright (C) Ben Parbury - All Rights Reserved. Unauthorized copying of this file, via any medium is strictly prohibited. Written by Ben Parbury <ben@gridlockinteractive.com> 2014

EPauseReason =
{
	Loading : "loading",	//We're loading on unloading the level
	Player : "player",		//The player has requested the game was paused
	Editor : "editor",		//The editor option says we're paused
}

var gPause = new Pause();

function Pause()
{
	this.paused = new Array();
	
	for(var reason in EPauseReason)
	{
		this.paused[EPauseReason[reason]] = false;
	}
	
	this.Pause = function(reason, enable)
	{
		this.paused[reason] = enable;
		gConsole.Log(8, "[PAUSE] " + reason + " - " + enable);
		if (reason == EPauseReason.Player)
		{
			gIconsOverlay.Redraw();
		}
	}
	
	this.IsPaused = function(reason)
	{
		if(reason)
		{
			return this.paused[reason];
		}
		else
		{
			for(var pauseReason in EPauseReason)
			{
				if(this.paused[EPauseReason[pauseReason]])
				{
					return true;
				}
			}
			return false;
		}
	}
}

