Example #1
0
        public void CreateMap(IMap map, bool createEmptyCells)
        {
            m_Root  = new GameObject("map_root");
            m_Cells = new GameObject[map.GetWidth()][];

            for (int x = 0; x < map.GetWidth(); ++x)
            {
                m_Cells[x] = new GameObject[map.GetHeight()];

                for (int y = 0; y < map.GetHeight(); ++y)
                {
                    IMapCell mapCell = map.GetCell(x, y);

                    if (!createEmptyCells && mapCell.GetCellType().Equals(0))
                    {
                        continue;
                    }

                    byte cellPrefabIndex = mapCell.GetCellType();
                    byte surfaceType     = mapCell.GetSurfaceType();

                    CreateCellAt(x, y, cellPrefabIndex, surfaceType);
                }
            }

            ICheckPointsManager checkPointsManager = map.GetCheckPointsManager();

            foreach (ICheckPoint checkPoint in checkPointsManager.GetCheckPoints())
            {
                CreateCheckPoint(checkPoint);
            }
        }
Example #2
0
        public DefaultMap(int width, int height, ICheckPointsManager checkPointsManager)
        {
            m_Width             = width;
            m_Height            = height;
            m_MapCells          = new IMapCell[width, height];
            m_CheckPointManager = checkPointsManager;

            Init();
        }