public AnimatedTile(BlockType block) : base(block) { if (block.Type.HasFlag(TileType.Animated)) Block = block; else throw new InvalidOperationException(block.Name + " is not an AnimatedTile"); }
public BlockMessage(BlockType block, int x, int y, int z) { if (z > 1) //Throw an exception if the Z is out of range throw new System.ArgumentOutOfRangeException("The Z coordinate cannot be more than 1"); this.BlockID = block.ID; this.X = (short)x; this.Y = (short)y; this.Z = (byte)z; this.MessageTime = NetTime.Now; }
/// <summary> /// Adds/Creates all of the block type's /// </summary> public static void Init() { Empty = new BlockType("Empty", Layer.All, Rectangle.Empty); Default = new BlockType("Default", Layer.All, new Rectangle(0, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Stone = new BlockType("Stone", Layer.All, new Rectangle(Tile.DrawWidth, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Dirt = new BlockType("Dirt", Layer.All, new Rectangle(Tile.DrawWidth * 2, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Grass = new BlockType("Grass", Layer.All, new Rectangle(Tile.DrawWidth * 3, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Wood = new BlockType("Wood", Layer.All, new Rectangle(Tile.DrawWidth * 4, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Brick = new BlockType("Brick", Layer.All, new Rectangle(Tile.DrawWidth * 5, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Slab = new BlockType("Slab", Layer.All, new Rectangle(Tile.DrawWidth * 6, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); Glass = new BlockType("Glass", Layer.All, new Rectangle(Tile.DrawWidth * 7, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Impassable); UpArrow = new BlockType("Up Arrow", Layer.Foreground, new Rectangle(Tile.DrawWidth * 8, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Gravity); DownArrow = new BlockType("Down Arrow", Layer.Foreground, new Rectangle(Tile.DrawWidth * 10, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Gravity); LeftArrow = new BlockType("Left Arrow", Layer.Foreground, new Rectangle(Tile.DrawWidth * 9, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Gravity); RightArrow = new BlockType("Right Arrow", Layer.Foreground, new Rectangle(Tile.DrawWidth * 11, 0, Tile.DrawWidth, Tile.DrawHeight), BlockCollision.Gravity); }
/// <summary> /// Sets or creates a new block /// </summary> public Tile(BlockType block) { Block = block; }