Exemplo n.º 1
0
    private void SetRandomBlock(SquareCellWithWall self, SquareDirection neighborDir, int probability)
    {
        if (self == null)
        {
            return;
        }

        SquareCellWithWall neighbor = self.neighbors[(int)neighborDir] as SquareCellWithWall;

        if (self == null)
        {
            return;
        }

        if (neighbor == null)
        {
            return;
        }

        if (UnityEngine.Random.Range(0, 100) <= probability)
        {
            self.SetNeighbor(neighborDir, null);

            SquareDirection selfDir = neighborDir.Opposite();
            neighbor.SetNeighbor(selfDir, null);
        }
    }
Exemplo n.º 2
0
 public override void SetNeighbor(SquareDirection direction, SquareCell cell)
 {
     if (cell == null)
     {
         neighbors[(int)direction] = null;
     }
     else
     {
         neighbors[(int)direction] = cell;
         cell.neighbors[(int)direction.Opposite()] = this;
     }
 }
Exemplo n.º 3
0
 public void SetNeighbor(SquareDirection direction, SquareCell cell)
 {
     neighbors[(int)direction] = cell;
     cell.neighbors[(int)direction.Opposite()] = this;
 }
Exemplo n.º 4
0
 public void SetNeighbor(SquareDirection direction, Block block)
 {
     neighbors[(int)direction] = block;
     block.neighbors[(int)direction.Opposite()] = this;
 }