예제 #1
0
        private void InitTiles(IRawMap map)
        {
            Tiles     = new Tile[Height][];
            FlatTiles = new List <Tile>(Width * Height);
            for (var y = 0; y < Height; y++)
            {
                Tiles[y] = new Tile[Width];
                for (var x = 0; x < Width; x++)
                {
                    var rawTile = map.Map[y][x].ToString();

                    var type = rawTile switch
                    {
                        MapKey.Asteroid => TileType.Asteroid,
                        MapKey.Empty => TileType.Empty,
                        _ => throw new Exception("Unknown tile type")
                    };

                    Tiles[y][x] = new Tile(type, new Coordinates(x, y));
                    FlatTiles.Add(Tiles[y][x]);
                }
            }
        }
    }
예제 #2
0
파일: Map.cs 프로젝트: CodeForCSharp/ing
 partial void UpdateCore(IRawMap raw)
 {
     Info = owner.MasterData.MapInfos[raw.Id];
 }
예제 #3
0
 public Map(IRawMap rawMap)
 {
     Width  = rawMap.Map[0].Length;
     Height = rawMap.Map.Count;
     InitTiles(rawMap);
 }
예제 #4
0
파일: Map.cs 프로젝트: Elenw/ing
 partial void UpdateCore(IRawMap raw, DateTimeOffset timeStamp)
 {
     Info = owner.MasterData.MapInfos[raw.Id];
 }