public void StartGame() { for (int x = 0; x < m_boardState.BoardSize.x; x++) { for (int y = 0; y < m_boardState.BoardSize.y; y++) { IPiece oldPiece = m_visualState[x, y]; if (oldPiece != null) { oldPiece.Dispose(); } IPiece piece = m_pieceFactory.CreatePiece(m_boardState.State[x, y]); piece.Init(x, m_boardState.BoardSize.y + y); piece.Move(new Vector2Int(x, y)); m_visualState[x, y] = piece; } } }