void Awake() { m_cellCount = Cells; m_cellDimensions = CellDimensions; m_cellPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/GridCell"), Vector3.zero, Quaternion.identity) as GameObject; m_blockPrefabs = new List<GameObject>() { GameObject.Instantiate(Resources.Load("Prefabs/Blocks/EmptyBlock"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/Movable"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/NonMovable"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerLeft"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerRight"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerSwipe"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/SlowPowerUp"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/BombPowerUp"), Vector3.zero, Quaternion.identity) as GameObject, }; m_paralaxFarPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/ParalaxFar"), Vector3.zero, Quaternion.identity) as GameObject; m_paralaxNearPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/ParalaxNear"), Vector3.zero, Quaternion.identity) as GameObject; }
void Awake() { m_cellCount = Cells; m_cellDimensions = CellDimensions; m_cellPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/GridCell"), Vector3.zero, Quaternion.identity) as GameObject; m_blockPrefabs = new List <GameObject>() { GameObject.Instantiate(Resources.Load("Prefabs/Blocks/EmptyBlock"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/Movable"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/NonMovable"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerLeft"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerRight"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/LaneChangerSwipe"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/SlowPowerUp"), Vector3.zero, Quaternion.identity) as GameObject, GameObject.Instantiate(Resources.Load("Prefabs/Blocks/BombPowerUp"), Vector3.zero, Quaternion.identity) as GameObject, }; m_paralaxFarPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/ParalaxFar"), Vector3.zero, Quaternion.identity) as GameObject; m_paralaxNearPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Levels/ParalaxNear"), Vector3.zero, Quaternion.identity) as GameObject; }
public void Init(int width, int height, StreamReader reader = null) { if (m_cells != null) { Reset(); return; } if (m_cellCount == null) { m_cellCount = new CellCount(); } m_cellCount.X = width; m_cellCount.Y = height; m_cells = new List <List <GameObject> >(m_cellCount.Y); for (int y = 0; y < m_cellCount.Y; ++y) { List <GameObject> newColumn = new List <GameObject>(m_cellCount.X); for (int x = 0; x < m_cellCount.X; ++x) { GameObject cell = GameObject.Instantiate(m_cellPrefab); GameObject tile = null; if (reader != null) { int index = int.Parse(reader.ReadLine()); if (index > 0) { tile = GameObject.Instantiate(m_blockPrefabs[index]); } } InitCell(cell, tile, x, y); newColumn.Add(cell); } m_cells.Add(newColumn); } InitParalax(); }
public void Init(int width, int height, StreamReader reader = null) { if(m_cells != null) { Reset(); return; } if(m_cellCount == null) m_cellCount = new CellCount(); m_cellCount.X = width; m_cellCount.Y = height; m_cells = new List<List<GameObject>>(m_cellCount.Y); for (int y = 0; y < m_cellCount.Y; ++y) { List<GameObject> newColumn = new List<GameObject>(m_cellCount.X); for (int x = 0; x < m_cellCount.X; ++x) { GameObject cell = GameObject.Instantiate(m_cellPrefab); GameObject tile = null; if(reader != null) { int index = int.Parse(reader.ReadLine()); if(index > 0) { tile = GameObject.Instantiate(m_blockPrefabs[index]); } } InitCell(cell, tile, x, y); newColumn.Add(cell); } m_cells.Add(newColumn); } InitParalax(); }