public virtual void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color) { lock (Locked) { render.Draw(texture, new Rectangle((int)pos.X, (int)pos.Y, 16, 16), new Rectangle(16 * frame, 16 * subTexture, 16, 16), color); } }
/// <exception cref="EndOfStreamException">The end of the stream is reached. </exception> /// <exception cref="IOException">An I/O error occurs. </exception> /// <exception cref="ObjectDisposedException">The stream is closed. </exception> public void Read(BinaryReader reader, int version) { /* * public bool active = false; * public bool infected = false; * public int light = 0; * public int blockheight = 1; * public float HP { get; set; } * public short Idtexture; * public short IdWall; * public short IdPoster; */ Active = reader.ReadBoolean(); if (version <= new NamingVersion(0, 0, 0, 0, 2, 0).GetCode()) { reader.ReadBoolean(); Light = (short)reader.ReadInt32(); Blockheight = (short)reader.ReadInt32(); } else { Light = reader.ReadInt16(); Blockheight = reader.ReadInt16(); } Hp = (float)reader.ReadDouble(); IdTexture = reader.ReadInt16(); IdSubTexture = reader.ReadByte(); //TODO if (Active && IdTexture >= 0 && IdTexture < _tileMax) { TileDate = _tileListCurrent[IdTexture].ChangeTile(); } IdWall = reader.ReadInt16(); IdPoster = reader.ReadInt16(); }
public override void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color) { if (dimension.MapTile[x, y].IdTexture == dimension.MapTile[x - 1, y].IdTexture) { frame += 1; } base.Render(tileDate, render, texture, dimension, pos, x, y, frame, subTexture, color); }
public void UpdateTileDate() { if (IdTexture >= _tileMax) { return; } TileDate = _tileListCurrent[IdTexture].ChangeTile(); TileDate?.Init(); }
public Tile(BaseDimension dimension) { _dimension = dimension; IdWall = -1; IdPoster = -1; Blockheight = 1; WaterType = 0; Frame = 0; IdSubTexture = 0; Active = false; Light = 0; IdTexture = 0; Hp = 0; TileDate = null; TimeCount = 0; }
public override void Render(ITileDatecs tileDate, Render render, Texture2D texture, BaseDimension dimension, Vector2 pos, int x, int y, int frame, int subTexture, ColorScheme color) { TreeDate treeDate = (TreeDate)tileDate; if (dimension.MapTile[x, y].IdTexture == 16) { render.Draw(texture, new Rectangle((int)pos.X - 25, (int)pos.Y - 42, 64, 64), new Rectangle(64 * frame, 64 * treeDate.TypeTree, 64, 64), color); } else if (dimension.MapTile[x, y].IdTexture == 38) { render.Draw(texture, new Rectangle((int)pos.X, (int)pos.Y, 16, 16), new Rectangle(16 * subTexture, 16 * treeDate.TypeTree, 16, 16), color); } else { base.Render(tileDate, render, texture, dimension, pos, x, y, frame, subTexture, color); } }