protected void StableBoardLose()
	{	
		levelWon = false;
		
		OnStableBoard -= StableBoardLose;
		
		WinLoseRaiseEvent = OnLoseFinished;
		
		if (winConditions.GetType() == typeof(WinScore)) {
			callFreeFallEvent = true;
			StartCoroutine(FreeFall());
		}
		else 
		{
			SendEndGameAnalytics();
			OnLoseFinished.RaiseEvent();
		}
	}
	protected void StableBoardWin()
	{
		levelWon = true;

		OnStableBoard -= StableBoardWin;
		
		loseConditions.DoWin();
		WinLoseRaiseEvent = OnWinFinished;
		
		if (!freeFalling) {
			callFreeFallEvent = true;
			StartCoroutine(FreeFall());
		}

		//OnWinFinished.RaiseEvent();
	}
Ejemplo n.º 3
0
	/// <summary>
	/// Registers a GameObject to a <see cref="GameObjectEvent"/>.
	/// The GameObject is added to the GameObjectEvent Targets list. If the "allowDuplicates" is set to false
	/// then a check will be done to see if the same GameObject is not already registered to this event.
	/// </summary>
	/// <param name='gameObject'>
	/// Game object.
	/// </param>
	/// <param name='gameObjEvent'>
	/// Game object event.
	/// </param>
	/// <param name='gameObjMessage'>
	/// Game object message.
	/// </param>
	/// <param name='allowDuplicates'>
	/// Allow duplicates. Default is true.
	/// If set to false there is an overhead involved in checking the the Targets objects list and the Messages list for the duplicates.
	/// </param>
	public static void RegisterToEvent(this GameObject gameObject, GameObjectEvent gameObjEvent, string gameObjMessage, bool allowDuplicates = true) 
	{
		if (gameObjEvent != null) 
		{
			if ( !allowDuplicates && gameObjEvent.Targets.Contains(gameObject) && gameObjEvent.Messages.Contains(gameObjMessage) ) 
			{
				return;
			}
			gameObjEvent.Targets.Add(gameObject);
			gameObjEvent.Messages.Add(gameObjMessage);
		}
	}