Guest User

Untitled

a guest
Jul 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. //Draw cubes and store data
  2. function Awake () {
  3. for(var z=0;z<8;z++)
  4. {
  5. for(var y=0;y<8;y++)
  6. {
  7. for(var x=0;x<8;x++)
  8. {
  9.  
  10. Instantiate(newCube,position,rotation);
  11. newCube.position = position;
  12. cubeList[cubeCount].Cube = newCube;
  13.  
  14. cubeCount++;
  15. position.x += 1.1;
  16. }
  17. position.x = 0;
  18. position.y += 1.1;
  19. }
  20. position.y = 0;
  21. position.z += 1.1;
  22. }
  23. }
  24. At the moment to find the cube in the array I am using:
  25.  
  26. function OnMouseDown()
  27. {
  28.  
  29. for(i=0;i<511;i++)
  30. {
  31.  
  32. if(transform.position.x == Main.cubeList[i].xpos)
  33. {
  34. Main.cubeList[i].colour = currentColour;
  35. Main.cubeList[i].selected = isSelected;
  36.  
  37. }
  38. }
  39. }
Add Comment
Please, Sign In to add comment