// Start is called before the first frame update void Start() { ++Ctree.total_tree_count; // ------------------------------- Tree //boxObject = (GameObject)Resources.Load("Prefabs/TreeGroup"); // 시작 시 기본 생성 나무 //obj_box = Instantiate(boxObject); // , transform //obj_box.transform.Translate(0, 0, 0); //obj_list.Add(obj); // List Start 원소 추가 //Ctree.cb_vec_tree = obj_box.transform.position; //Ctree.gText = Ctree.cb_vec_tree.ToString(); //Debug.Log(Ctree.cb_vec_tree); // ------------------------------- Cylinder /* * testObject = (GameObject)Resources.Load("Prefabs/Cylinder 1"); * test_box = Instantiate(testObject); // , transform * test_box.transform.Translate(-30, 0, -20); * test_box_list.Add(test_box); * * textObject = (GameObject)Resources.Load("Prefabs/CylinderText"); * text_box = Instantiate(textObject); // , transform * text_box.transform.Translate(0, 0, 0); * text_box_list.Add(text_box); */ // ------------------------------- CylinderClass //custom_cylinder = new CylinderClass((GameObject)Resources.Load("Prefabs/Cylinder 1"), (GameObject)Resources.Load("Prefabs/CylinderText"), (GameObject)Resources.Load("Prefabs/TreeGroup")); custom_cylinder = new CylinderClass((GameObject)Resources.Load("Prefabs/TreeGroup")); cylinder_list.Add(custom_cylinder); //Debug.Log(CylinderClass.cylinder_name); }
void OnMouseDown() { ++Ctree.total_tree_count; // ------------------------------- Tree //boxObject = (GameObject)Resources.Load("Prefabs/TreeGroup"); //obj_box = Instantiate(boxObject); //obj_box.transform.Translate((Ctree.total_tree_count - 1) * 10, 0, 0); //obj_list.Add(obj); // List Update 원소 추가 //Ctree.cb_vec_tree = obj.transform.position; //Ctree.gText = Ctree.cb_vec_tree.ToString(); // ------------------------------- Cylinder /* * testObject = (GameObject)Resources.Load("Prefabs/Cylinder 1"); * test_box = Instantiate(testObject); // , transform * test_box.transform.Translate((Ctree.total_tree_count - 1) * 10 - 30, 0, -20); * test_box_list.Add(test_box); * * textObject = (GameObject)Resources.Load("Prefabs/CylinderText"); * text_box = Instantiate(textObject); // , transform * text_box.transform.Translate(0, 0, (Ctree.total_tree_count - 1) * 10); * text_box_list.Add(text_box); * * Debug.Log(text_box_list.Count); */ // ------------------------------- Cylinder Class try { if ((Ctree.total_tree_count <= 50) == false) { throw new Exception("Out of Range error...."); } else { custom_cylinder = new CylinderClass((GameObject)Resources.Load("Prefabs/TreeGroup")); cylinder_list.Add(custom_cylinder); } } catch (Exception e) { Debug.LogError(e); } Debug.Log(CylinderClass.cylinder_name); }