sing UnityEngine;

using System.Collections;


public class Primative : MonoBehaviour {

public int Count = 3;

public int TotalRow =5;

public int TotalCol =10;

GameObject cube,cube1,cube3,cube4,cube5,cube6;

int row;

int col;

// Use this for initialization

void Start () {

for(int row = 1; row <= TotalRow; row++)

{

//cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

//cube.transform.position = new Vector3(i*2, 0, 0);

for(int col = 1; col <= TotalCol; col++)

{

//row col 0 2 4 6 8                  row 1 3 5 7 9

if((row % 2 ==0 && col % 2 == 0) || (row % 2 == 1 && col % 2 == 1))

{

cube1 = GameObject.CreatePrimitive(PrimitiveType.Cube);

cube1.transform.position = new Vector3(col*2, row*2, 0);

if (row==1 && col==1)

{  

cube = cube1;

}

if (row==1 && col==3)

{

cube3 = cube1;

}

if (row==1 && col==5)

{

cube4 = cube1;

}

if (row==1 && col==7)

{

cube5 = cube1;

}

if (row==1 && col==9)

{

cube6 = cube1;

}

}

}

}

Debug.Log("Cube : x= " + cube.transform.position.x 

+ "Cube : y= " + cube.transform.position.y + "Cube : z= " + cube.transform.position.z);

}

// Update is called once per frame

void Update () {

cube.transform.Rotate(10, 10, 10);

cube3.transform.Rotate(10, 10, 10);

cube4.transform.Rotate(10, 10, 10);

cube5.transform.Rotate(10, 10, 10);

cube6.transform.Rotate(10, 10, 10);

/*

GameObject Capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule);

Debug.Log("Capsule : x= " + Capsule.transform.localScale.x 

+ "Capsule : y= " + Capsule.transform.position.y + "Capsule : z= " + Capsule.transform.position.z);

*/

}

}


/*

cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

Debug.Log("Cube : x= " + cube.transform.position.x 

+ "Cube : y= " + cube.transform.position.y + "Cube : z= " + cube.transform.position.z);

Debug.Log("Cube : x= " + cube.transform.localScale.x);

cube.transform.position=new Vector3(1,0,0);

cube1 = GameObject.CreatePrimitive(PrimitiveType.Cube);

Debug.Log("Cube : x= " + cube.transform.position.x 

+ "Cube : y= " + cube.transform.position.y + "Cube : z= " + cube.transform.position.z);

Debug.Log("Cube : x= " + cube.transform.localScale.x);

cube1.transform.position=new Vector3(3,0,0);

*/



'Computer Language > 유니티' 카테고리의 다른 글

자료형(정수)  (0) 2014.03.31
왼쪽 오른쪽 이동 그리고 정지  (0) 2014.03.31
탱크 이동  (0) 2014.03.28
고스톱 만들기(두 좌표의 차이를 이용하여 이동)  (0) 2014.03.28
c#  (0) 2014.03.28

+ Recent posts