Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector3[] suuntaVektorit = { new Vector3 { x = -1, y = 0, z = 0 },
- new Vector3 { x = 0, y = 0, z = 1},
- new Vector3 { x = 1, y = 0, z = 0},
- new Vector3 { x = 0, y = 0, z = -1}
- };
- // nolla aloittaa, eli suunnat ovat 0,1,2,3 (eikä 1,2,3,4)
- public static void MovePiece(int direction, GameObject movingPiece)
- {
- Vector3 indexCheck = movingPiece.transform.position + suuntaVektorit[direction];
- if (indexCheck.x < boardX && indexCheck.x > 0) {
- if (indexCheck.z < boardZ && indexCheck.z > 0) {
- movingPiece.transform.position += suuntaVektorit[direction];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement