Beispiel #1
0
	void Update()
	{
		// Check if the current player has won.
		if(gameStarted && currentPlayer.HandEmpty)
		{
			Debug.Log( currentPlayer.ToString() + " won!" );
			gameOver = true;
		}
		else if(!gameOver && currentPlayer != null)
		{
			currentPlayer.UpdateState();
		}

		if(gameStarted && currentPlayer.TurnOver && !movingIndicator)
		{
			if((int)turnState == 3)
			{
				turnState = (ETurnState)0;
			}
			else
			{
				int nextTurn = (int)turnState + 1;
				turnState = (ETurnState)nextTurn;
			}
			movingIndicator = true;
			StartCoroutine( ChangePlayers(1) );
		}
	}
Beispiel #2
0
	IEnumerator DealCards()
	{
		for(var i = 0; i < 7; i++)
		{
			for(var j = 0; j < 4; j++)
			{
				turnState = (ETurnState)j;
				StartCoroutine( ChangePlayers(-1) );
				yield return new WaitUntil(() => !currentPlayer.TurnOver);
				currentPlayer.AddCard(deck[0],true);
				deck.RemoveAt(0);
				yield return new WaitUntil(() => currentPlayer.TurnOver);
			}
		}

		//Turn the top card over
		playedCards.Add( deck[0] );
		StartCoroutine( lerp.LerpMove2D(deck[0].CardGO,deckPosition,turnCardPosition,false,0.5f,false) );
		deck.RemoveAt(0);
		yield return new WaitForSeconds(1f);
		StartGame();
	}