comparison Assets/Application/Scripts/StageManager.cs @ 11:cf20add31466

change putAttribute -> use fmap.
author Kazuma Takeda
date Sat, 28 Jan 2017 19:15:44 +0900
parents 3fefb9f9025d
children b55d586dd4eb
comparison
equal deleted inserted replaced
10:3fefb9f9025d 11:cf20add31466
6 6
7 public class StageManager : MonoBehaviour { 7 public class StageManager : MonoBehaviour {
8 8
9 private float _maxHeight = 10; 9 private float _maxHeight = 10;
10 10
11 //パーリンノイズを使ったマップか 11 // パーリンノイズを使ったマップか
12 [SerializeField] 12 [SerializeField]
13 private bool _isPerlinNoiseMap = true; 13 private bool _isPerlinNoiseMap = true;
14 14
15 //起伏の激しさ 15 // 起伏の激しさ
16 [SerializeField] 16 [SerializeField]
17 private float _relief = 15f; 17 private float _relief = 15f;
18 18
19 //Y座標を滑らかにするか(小数点以下をそのままにする) 19 // Y座標を滑らかにするか(小数点以下をそのままにする)
20 [SerializeField] 20 [SerializeField]
21 private bool _isSmoothness = false; 21 private bool _isSmoothness = false;
22 22
23 //マップの大きさ 23 // マップの大きさ
24 [SerializeField] 24 [SerializeField]
25 private float _mapSize = 1f; 25 private float _mapSize = 1f;
26 26
27 public static StageManager Instance; 27 public static StageManager Instance;
28 private GameObject baseStage; 28 private GameObject baseStage;
83 string type = attr.getString ("Category"); 83 string type = attr.getString ("Category");
84 84
85 TreeNode item_node = getItem (box_node, ItemID); 85 TreeNode item_node = getItem (box_node, ItemID);
86 86
87 attr = item_node.getAttributes (); 87 attr = item_node.getAttributes ();
88 string subType = attr.getString ("Type"); 88 ItemInfo iteminfo = attr.get<ItemInfo> ("ItemInfo");
89 string broken = attr.getString ("Broken");
90 string itemID = attr.getString ("ID");
91 string color_code = attr.getString ("Color");
92 89
93 GameObject item = Resources.Load<GameObject> ("Prefabs/" + type + "/Box"); 90 GameObject item = Resources.Load<GameObject> ("Prefabs/" + type + "/Box");
94 GameObject obj = Instantiate (item); 91 GameObject obj = Instantiate (item);
95 obj.GetComponent<Item> ().SetItem (Convert.ToInt32 (broken), subType, itemID, TotalIndex, color_code); 92 obj.GetComponent<Item> ().SetItem (iteminfo ,TotalIndex);
96 obj.transform.position = new Vector3 (v.x, v.y, v.z); 93 obj.transform.position = new Vector3 (v.x, v.y, v.z);
97 obj.transform.SetParent (baseStage.transform); 94 obj.transform.SetParent (baseStage.transform);
98 obj.GetComponent<Item> ().SetCreateTreeNode (); 95 obj.GetComponent<Item> ().SetCreateTreeNode ();
99 96
100 AddTotalIndex (); 97 AddTotalIndex ();