I'm making checkers game in Unity, and and I have piece object with one tile move animation inside (GameObject). When I click new position, animation is triggered and piece moves. But after that, moving this piece to next tile(new coordinate) does not work !
Here is the code for that Part!
if(selectedPiece.ValidMove(pieces, x1, y1, x2, y2, hasKilled))
{
// Tile jump check
if (Mathf.Abs (x2 - x1) == 1) {
if(selectedPiece.isWhite)
{
if(selectedPiece.transform.position.x < mouseOver.x)
{
// default
selectedPiece.GetComponentInChildren<Animator>().SetTrigger("tileJump");
selectedPiece.transform.GetChild(0).transform.position = Vector2.zero;
//pieces[x2, y2] = selectedPiece;
pieces[x1, y1] = null;
//MovePiece (selectedPiece, x2, y2);
}else{
selectedPiece.GetComponentInChildren<Animator>().SetTrigger("tileJump");
}
}
}
}