Mercurial > hg > Members > kazuma > JungleforUnity
diff 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 |
line wrap: on
line diff
--- a/Assets/Application/Scripts/StageManager.cs Wed Jan 18 22:00:24 2017 +0900 +++ b/Assets/Application/Scripts/StageManager.cs Fri Jan 20 07:30:26 2017 +0900 @@ -92,15 +92,11 @@ GameObject item = Resources.Load<GameObject> ("Prefabs/" + type + "/Box"); GameObject obj = Instantiate (item); - obj.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, itemID, TotalIndex); + obj.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, itemID, TotalIndex, color_code); obj.transform.position = new Vector3 (v.x, v.y, v.z); obj.transform.SetParent (baseStage.transform); obj.GetComponent<Item> ().SetCreateTreeNode (); - Color color = Color.black; - ColorUtility.TryParseHtmlString(color_code, out color);//草っぽい色 - obj.GetComponent<MeshRenderer> ().material.color = color; - AddTotalIndex (); } @@ -177,14 +173,12 @@ TreeNode item_node = getItem (node, item_id); Attributes attr = item_node.getAttributes (); - string subType = attr.getString ("Type"); - string broken = attr.getString ("Broken"); - string itemID = attr.getString ("ID"); - string color_code = attr.getString ("Color"); +// string subType = attr.getString ("Type"); +// string broken = attr.getString ("Broken"); +// string color_code = attr.getString ("Color"); - cube.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, item_id.ToString(), TotalIndex); + ItemInfo item = attr.get<ItemInfo>("ItemInfo"); - ColorUtility.TryParseHtmlString(color_code, out color);//草っぽい色 - cube.GetComponent<MeshRenderer> ().material.color = color; + cube.GetComponent<Item> ().SetItem (item, TotalIndex); } }