Example #1
0
        //protected Greed childrenGreed;


        //public Cell(Pos pos, SortedList<ushort, Cell> neighbors, object owner)
        //        public Cell(Pos pos, SortedList<ushort, Cell> neighbors, Cell parent, object owner)
        public Cell(CellPos pos, Cell parent, object owner)
        {
            this.pos = pos;
            this.parent = parent;

            /*
            if (parent == null)
            {
                neighbors = new SortedList<ushort, Cell>();
                neighborsBinaryGrid = new BinaryGrid((byte)Pos.WIDTH, (byte)Pos.HEIGHT);
            } else
            {
                neighbors = parent.children;
                neighborsBinaryGrid = parent.neighborsBinaryGrid;
            }
            */

            childrenBinaryGrid = new BinaryGrid((byte)Pos.WIDTH, (byte)Pos.HEIGHT);


            this.neighbors = parent == null ? new SortedList<ushort, Cell>() : parent.children;

            this.owner = owner == null ? this : owner;
            children = new SortedList<ushort, Cell>();

            neighbors [pos.index] = this;
//            neighborsBinaryGrid.Set(pos.x, pos.y, pos.z);
            if (parent != null)
                parent.childrenBinaryGrid.Set(pos.x, pos.y, pos.z);

            AddNeighbors();
            AddToNeighbors();
        }
Example #2
0
        public ChunkCell(CellPos pos, Cell parent, object owner) : base(pos, parent, owner)
        {
            childrenOpacityBinaryGreed = new BinaryGrid((byte)Pos.WIDTH, (byte)Pos.HEIGHT);
            childrenLightsTypes = new Dictionary<byte, LightType>();

            if (neighborsArray == null)
                neighborsArray = new ChunkCell[27];
        }
Example #3
0
 public LightType(byte type, Color32 color32, byte distance) : base(type, color32, distance)
 {
     binaryGrid = new BinaryGrid((byte)Pos.WIDTH, (byte)Pos.HEIGHT);
 }