SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top