예제 #1
0
	void ToggleSquare(int x, int y, int z, Quaternion r, int t, int f)
	{
		if (grid[x, y, z] == null)
		{
			if (blockTypes[t] == block_normal)
				grid[x, y, z] = new ControllerGame.BlockNormal(
					controllerGame.block_normal,
					controllerGame.anchor_line,
					controllerGame.anchor_point,
					new Vector3(x - offset, y - offset, z - offset),
					r.eulerAngles, (f == 1));

			else if (blockTypes[t] == block_twist)
				grid[x, y, z] = new ControllerGame.BlockTwist(
					controllerGame.block_twist,
					controllerGame.anchor_line,
					controllerGame.anchor_point,
					new Vector3(x - offset, y - offset, z - offset),
					r.eulerAngles, (f == 1));

			else if (blockTypes[t] == block_edge)
				grid[x, y, z] = new ControllerGame.BlockEdge(
					controllerGame.block_edge,
					controllerGame.anchor_line,
					controllerGame.anchor_point,
					new Vector3(x - offset, y - offset, z - offset),
					r.eulerAngles, (f == 1));

			else if (blockTypes[t] == block_stairs)
				grid[x, y, z] = new ControllerGame.BlockStairs(
					controllerGame.block_stairs,
					controllerGame.anchor_line,
					controllerGame.anchor_point,
					new Vector3(x - offset, y - offset, z - offset),
					r.eulerAngles, 
					controllerGame.block_stairs_hide);

			controllerGame.block_list.Add(grid[x, y, z]);
		}
		else
		{
			//grid[x, y, z].remove_existance(controllerGame);
		}
	}
예제 #2
0
    void ToggleSquare()
    {
        int x = (int)cursor.transform.position.x + offset;
        int y = (int)cursor.transform.position.y + offset;
        int z = (int)cursor.transform.position.z + offset;

		if (grid[x, y, z] != null)
		{
			grid[x, y, z].remove_existance(controllerGame);
			grid[x, y, z] = null;
		}
		else
		{
			if (blockTypes[(cursorIndex-1 )% typeNum] == block_normal)
				grid[x, y, z] = new ControllerGame.BlockNormal(
					controllerGame.block_normal, 
					controllerGame.anchor_line, 
					controllerGame.anchor_point, 
					new Vector3(x - offset, y - offset, z - offset),
					cursor.transform.eulerAngles, false);

			else if (blockTypes[(cursorIndex-1 )% typeNum] == block_twist)
				grid[x, y, z] = new ControllerGame.BlockTwist(
					controllerGame.block_twist,
					controllerGame.anchor_line, 
					controllerGame.anchor_point, 
					new Vector3(x - offset, y - offset, z - offset), 
					cursor.transform.eulerAngles, false);

			else if (blockTypes[(cursorIndex-1 )% typeNum] == block_edge)
				grid[x, y, z] = new ControllerGame.BlockEdge(
					controllerGame.block_edge,
					controllerGame.anchor_line, 
					controllerGame.anchor_point, 
					new Vector3(x - offset, y - offset, z - offset), 
					cursor.transform.eulerAngles, false);

			else if (blockTypes[(cursorIndex-1 )% typeNum] == block_stairs)
				grid[x, y, z] = new ControllerGame.BlockStairs(
					controllerGame.block_stairs,
					controllerGame.anchor_line,
					controllerGame.anchor_point,
					new Vector3(x - offset, y - offset, z - offset),
					cursor.transform.eulerAngles, 
					controllerGame.block_stairs_hide);
			
			controllerGame.block_list.Add(grid[x, y, z]);
		}
    }