Mercurial > hg > Members > kazuma > JungleforUnity
comparison Assets/Application/Scripts/StageManager.cs @ 10:3fefb9f9025d
put Attribute class.
author | Kazuma Takeda |
---|---|
date | Fri, 20 Jan 2017 07:30:26 +0900 |
parents | bbab930748c4 |
children | cf20add31466 |
comparison
equal
deleted
inserted
replaced
9:bbab930748c4 | 10:3fefb9f9025d |
---|---|
90 string itemID = attr.getString ("ID"); | 90 string itemID = attr.getString ("ID"); |
91 string color_code = attr.getString ("Color"); | 91 string color_code = attr.getString ("Color"); |
92 | 92 |
93 GameObject item = Resources.Load<GameObject> ("Prefabs/" + type + "/Box"); | 93 GameObject item = Resources.Load<GameObject> ("Prefabs/" + type + "/Box"); |
94 GameObject obj = Instantiate (item); | 94 GameObject obj = Instantiate (item); |
95 obj.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, itemID, TotalIndex); | 95 obj.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, itemID, TotalIndex, color_code); |
96 obj.transform.position = new Vector3 (v.x, v.y, v.z); | 96 obj.transform.position = new Vector3 (v.x, v.y, v.z); |
97 obj.transform.SetParent (baseStage.transform); | 97 obj.transform.SetParent (baseStage.transform); |
98 obj.GetComponent<Item> ().SetCreateTreeNode (); | 98 obj.GetComponent<Item> ().SetCreateTreeNode (); |
99 | |
100 Color color = Color.black; | |
101 ColorUtility.TryParseHtmlString(color_code, out color);//草っぽい色 | |
102 obj.GetComponent<MeshRenderer> ().material.color = color; | |
103 | 99 |
104 AddTotalIndex (); | 100 AddTotalIndex (); |
105 } | 101 } |
106 | 102 |
107 public void CreateStageItem (Vector3 v) { | 103 public void CreateStageItem (Vector3 v) { |
175 } | 171 } |
176 | 172 |
177 TreeNode item_node = getItem (node, item_id); | 173 TreeNode item_node = getItem (node, item_id); |
178 Attributes attr = item_node.getAttributes (); | 174 Attributes attr = item_node.getAttributes (); |
179 | 175 |
180 string subType = attr.getString ("Type"); | 176 // string subType = attr.getString ("Type"); |
181 string broken = attr.getString ("Broken"); | 177 // string broken = attr.getString ("Broken"); |
182 string itemID = attr.getString ("ID"); | 178 // string color_code = attr.getString ("Color"); |
183 string color_code = attr.getString ("Color"); | |
184 | 179 |
185 cube.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, item_id.ToString(), TotalIndex); | 180 ItemInfo item = attr.get<ItemInfo>("ItemInfo"); |
186 | 181 |
187 ColorUtility.TryParseHtmlString(color_code, out color);//草っぽい色 | 182 cube.GetComponent<Item> ().SetItem (item, TotalIndex); |
188 cube.GetComponent<MeshRenderer> ().material.color = color; | |
189 } | 183 } |
190 } | 184 } |