Exemple #1
0
        public void AddTile(TileType type, int x, int y, uint layer)
        {
            if (layer > 2) layer = 2;

            switch (layer)
            {
                case 0:
                    Layer0Cells[x, y].AddTile(type);
                    Layer0Cells[x, y].SetPosition(x * CellSize, y * CellSize);
                    break;
                case 1:
                    Layer1Cells[x, y].AddTile(type);
                    Layer1Cells[x, y].SetPosition(x * CellSize, y * CellSize);
                    foreach (var l in _lights)
                    {
                        l.VisMap.AddRectangleOccluder(new FloatRect(x * 32, y * 32, 32, 32));
                    }
                    break;
                default:
                    Layer2Cells[x, y].AddTile(type);
                    Layer2Cells[x, y].SetPosition(x * CellSize, y * CellSize);
                    break;
            }
        }
        public void AddTile(TileType type)
        {
            if (Tiles.Count > 0 && Tiles.Peek().TextureName == type.TextureName) return;

            Tiles.Push(new TileSprite(type));
        }
 public TileSprite(TileType type, bool lightingEnabled) : this (type.TextureName, lightingEnabled)
 {
 }
 public TileSprite(TileType type) : this (type, type.LightingEnabled)
 {
 }