Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Vector3[] suuntaVektorit = { new Vector3 { x = -1, y = 0, z = 0 },
  2. new Vector3 { x = 0, y = 0, z = 1},
  3. new Vector3 { x = 1, y = 0, z = 0},
  4. new Vector3 { x = 0, y = 0, z = -1}
  5. };
  6.  
  7.  
  8.  
  9. // nolla aloittaa, eli suunnat ovat 0,1,2,3 (eikä 1,2,3,4)
  10.  
  11.  
  12.  
  13. public static void MovePiece(int direction, GameObject movingPiece)
  14. {
  15. Vector3 indexCheck = movingPiece.transform.position + suuntaVektorit[direction];
  16. if ((indexCheck.x < boardX) && (indexCheck.x > 0)) {
  17. if ((indexCheck.z < boardZ) && (indexCheck.z > 0)) {
  18. movingPiece.transform.position += suuntaVektorit[direction];
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement