Пример #1
0
	// Update is called once per frame
	void Update () 
	{
		if (!gameOver)
		{
			lastPlayerInput = m_playerInput.getPlayerInput();

			switch (lastPlayerInput)
			{
			case 0: // no input
			{
				break;
			}
				
			case 1: //Left
			{
				m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Left);
				m_playerInput.playerInputCycle();
				break;
			}
				
			case 2: //Down
			{
				m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Down);
				m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Down);
				m_playerInput.playerInputCycle();
				break;
			}
				
			case 3: //Right
			{
				m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Right);
				m_playerInput.playerInputCycle();
				break;
			}
				
			case 4: //Space (rotate)
			{
				m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Rotate);
				m_playerInput.playerInputCycle();
				break;
			}
				
			default:
			{
				break;
				//do nothing
			}
			}//end player input switch

			if (timerTmp == 12)
			{
				if (m_shapeMaker.getActiveShapeStatus())
				{
					//always try to move down each tick.
					m_shapeMaker.moveShape(m_gameBoard, ShapeMaker.Direction.Down);

					timerTmp = 0;
				}
				
				else
				{
					m_shapeMaker.spawnShape(); 
				}
			}

			else
			{
				timerTmp++;
			}

			gameOver = m_gameBoard.getGameOver();
			if (gameOver)
			{
				m_GameOver.setGameOver(true);
			}
		}//gameOver if
	} //end update()