// public object MyProperty { get; } public Block(Pos pos, ChunkCell parent, ushort type, ushort textureIndex, bool opacity) { this.pos = pos; this.parent = parent; this.type = type; this.textureIndex = textureIndex; this.opacity = opacity; parent.childrenBinaryGrid.Set(pos.x, pos.y, pos.z); if (opacity) parent.childrenOpacityBinaryGreed.Set(pos.x, pos.y, pos.z); blockFaces = new BlockFaces(); }
Block GetBlockByType(ushort type, Pos pos, ChunkCell parent)//, ushort textureIndex) { switch (type) { case 0: return new B0(pos, parent, 0, 0, true); case 1: return new B1(pos, parent, 1, 1, false); case 2: return new Block(pos, parent, 2, 2, false); case 3: return new Block(pos, parent, 3, 3, true); case 4: return new Block(pos, parent, 4, 4, false); case 5: return new BlockLight(pos, parent, 5, 5, new Light(0, new Color32(14, 14, 14, 255), 3)); case 6: return new BlockLight(pos, parent, 5, 5, new Light(1, new Color32(24, 0, 0, 255), 3)); } return null;//new Block(pos, parent, type, false); //Type[] bs = { B0, B1 }; // return new bs[type](pos, parent, type); // Type t = Type.GetType("B" + type.ToString()); // return t != null ? Activator.CreateInstance(t, pos, parent, type) as Block : null; }
public B0(Pos pos, ChunkCell parent, ushort type, ushort textureIndex, bool opacity) : base(pos, parent, type, textureIndex, opacity) { }
public BlockLight(Pos pos, ChunkCell parent, ushort type, ushort textureIndex, Light light) : base(pos, parent, type, textureIndex, false) { this.light = light; parent.AddLight(light, pos); }