示例#1
0
        public void AddTile(Position position, Tile tile)
        {
            if (!position.IsValid)
            {
                Logger.Error(string.Format("Attempt to set tile on invalid coordinate {0}.", position));
                return;
            }

            var node = _mapTree.Create(position.X, position.Y);
            var floor = node.CreateFloor(position.Z);

            if (floor.HasTile(position.X, position.Y))
            {
                Logger.Error(string.Format("Map already have a tile in coordinate {0}.", position));
            }
            else
            {
                floor.SetTile(position.X, position.Y, tile);
                tile.Node = node;
            }
        }
示例#2
0
 public void SetTile(int x, int y, Tile tile)
 {
     _tiles[x & Constants.FloorMask, y & Constants.FloorMask] = tile;
 }