Ejemplo n.º 1
0
        //       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();
        }
Ejemplo n.º 2
0
        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;

        }
Ejemplo n.º 3
0
Archivo: B0.cs Proyecto: nauroman/Cells
 public B0(Pos pos, ChunkCell parent, ushort type, ushort textureIndex, bool opacity) : base(pos, parent, type, textureIndex, opacity)
 {
 }
Ejemplo n.º 4
0
        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);
        }