Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Draw cubes and store data
- function Awake () {
- for(var z=0;z<8;z++)
- {
- for(var y=0;y<8;y++)
- {
- for(var x=0;x<8;x++)
- {
- Instantiate(newCube,position,rotation);
- newCube.position = position;
- cubeList[cubeCount].Cube = newCube;
- cubeCount++;
- position.x += 1.1;
- }
- position.x = 0;
- position.y += 1.1;
- }
- position.y = 0;
- position.z += 1.1;
- }
- }
- At the moment to find the cube in the array I am using:
- function OnMouseDown()
- {
- for(i=0;i<511;i++)
- {
- if(transform.position.x == Main.cubeList[i].xpos)
- {
- Main.cubeList[i].colour = currentColour;
- Main.cubeList[i].selected = isSelected;
- }
- }
- }
Add Comment
Please, Sign In to add comment