public Chunk this[Position position]
        {
            get
            {
                Chunk chunk;
                if (chunks.TryGetValue(position, out chunk))
                {
                    return(chunk);
                }

                chunk = new Chunk(position, noise);
                chunks.Add(position, chunk);

                foreach (Side side in SideExtensions.Sides)
                {
                    Chunk  sideChunk;
                    SByte2 offset = side.Vector();
                    if (chunks.TryGetValue(new Position(position.X + offset.X, position.Y + offset.Y), out sideChunk))
                    {
                        sideChunk.neighbours[(byte)side.Opposite()] = chunk;
                        chunk.neighbours[(byte)side] = sideChunk;

                        sideChunk.changed = true;
                        chunk.changed     = true;
                    }
                }
                return(chunk);
            }
        }
Ejemplo n.º 2
0
 public SByte4(SByte2 xy, SByte2 zw)
 {
     this.X = xy.X;
     this.Y = xy.Y;
     this.Z = zw.X;
     this.W = zw.Y;
 }
Ejemplo n.º 3
0
 public SByte4(sbyte x, SByte2 yz, sbyte w)
 {
     this.X = x;
     this.Y = yz.X;
     this.Z = yz.Y;
     this.W = w;
 }
Ejemplo n.º 4
0
 public SByte4(sbyte x, sbyte y, SByte2 zw)
 {
     this.X = x;
     this.Y = y;
     this.Z = zw.X;
     this.W = zw.Y;
 }
Ejemplo n.º 5
0
 public SByte4(SByte2 xy, sbyte z, sbyte w)
 {
     this.X = xy.X;
     this.Y = xy.Y;
     this.Z = z;
     this.W = w;
 }