Exemple #1
0
	public Game(BoardView boardView)
	{
		m_boardView = boardView;
		GameBoardBuilder builder = new GameBoardBuilder ();
		AddGameUnity (builder,Point.Make(0,4));

		m_logicBoard = builder.GetBoard ();

		m_currentSelection = m_logicBoard.Select (Point.Make(-1,-1));

		m_boardView.OnCellClicked.Register((x,y) =>{

			//TODO: Usar state pattern
			var point = Point.Make(x,y);
			Debug.Log(point);

			if(m_currentSelection.IsEmpty)
			{
				
				m_currentSelection = m_logicBoard.Select(point);
			}
			else
			{
				var visitor = new WalkVisitor(point);

				m_currentSelection.Commands.Visit(visitor);

				m_boardView.AddResult(visitor.Result);
				m_currentSelection = m_logicBoard.Select (Point.Make(-1,-1));
			}
		});

	}