private void Awake() { Storage3D.s_Instance = this; for (int i = 0; i < 2; i++) { StorageData storageData = new StorageData(); storageData.m_Type = (Storage3D.StorageType)i; storageData.m_Grid = new PocketGrid(); storageData.m_Model = base.transform.Find(storageData.m_Type.ToString()).gameObject; storageData.m_Plane = storageData.m_Model.transform.GetChild(0).GetComponent <Collider>(); storageData.m_Grid.m_Grid = storageData.m_Plane.gameObject; Storage3D.StorageType type = storageData.m_Type; if (type != Storage3D.StorageType.Box) { if (type == Storage3D.StorageType.Bag) { storageData.m_Grid.m_GridSize = new Vector2(5f, 7.5f); } } else { storageData.m_Grid.m_GridSize = new Vector2(10f, 15f); } storageData.m_Grid.Initialize(this.m_GridCellPrefab, BackpackPocket.Storage); this.m_Datas.Add(storageData); } base.gameObject.SetActive(false); }
public PocketGrid GetGrid(Storage3D.StorageType type) { foreach (StorageData storageData in this.m_Datas) { if (storageData.m_Type == type) { return(storageData.m_Grid); } } return(null); }