예제 #1
0
 public void AddTile(Tile t, float xOffset = 0, int yOffset = 0)
 {
     tiles.Add((Tile)t.Clone());
     if (t.Width > profile.Width)
     {
         profile.Width = t.Width;
     }
     if (t.Height > profile.Height)
     {
         profile.Height = t.Height;
     }
     t.position.X = xOffset;
     t.position.Y = yOffset;
 }
예제 #2
0
 public TileMap(Tile defaultTile, int width, int height, SpriteBatch sb = null)
 {
     this.width = width;
     this.height = height;
     this.data = new Tile[height, width];
     for (int i = 0; i < height; i++)
         for (int j = 0; j < width; j++)
         {
             data[i, j] = (Tile)defaultTile.Clone();
             data[i, j].position.Y = i * defaultTile.Height;
             data[i, j].position.X = j * defaultTile.Width;
         }
     this.sb = sb;
     this.mainTile = defaultTile;
     luaEvents = new Dictionary<string, List<LuaFunction>>();
 }
예제 #3
0
 public TileMap(Tile defaultTile, int width, int height, SpriteBatch sb = null)
 {
     this.width  = width;
     this.height = height;
     this.data   = new Tile[height, width];
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             data[i, j]            = (Tile)defaultTile.Clone();
             data[i, j].position.Y = i * defaultTile.Height;
             data[i, j].position.X = j * defaultTile.Width;
         }
     }
     this.sb       = sb;
     this.mainTile = defaultTile;
     luaEvents     = new Dictionary <string, List <LuaFunction> >();
 }
예제 #4
0
 public void AddTile(Tile t, float xOffset = 0, int yOffset = 0)
 {
     tiles.Add((Tile)t.Clone());
     if (t.Width > profile.Width) profile.Width = t.Width;
     if (t.Height > profile.Height) profile.Height = t.Height;
     t.position.X = xOffset;
     t.position.Y = yOffset;
 }
예제 #5
0
 public void AddObject(Tile t, Vector2 pos)
 {
     data[(int)pos.Y, (int)pos.X]            = (Tile)t.Clone();
     data[(int)pos.Y, (int)pos.X].position.X = pos.X * mainTile.Width;
     data[(int)pos.Y, (int)pos.X].position.Y = pos.Y * mainTile.Height;
 }
예제 #6
0
 public void AddObject(Tile t, Vector2 pos)
 {
     data[(int)pos.Y, (int)pos.X] = (Tile)t.Clone();
     data[(int)pos.Y, (int)pos.X].position.X = pos.X * mainTile.Width;
     data[(int)pos.Y, (int)pos.X].position.Y = pos.Y * mainTile.Height;
 }