//this method sets the HexPassable attribute in both ways between 2 neighbouring cells
    private void CreatePathWay(HexCellBehaviour cell, HexCellBehaviour neighbour)
    {
        HexPassable dir = FindDirection(cell, neighbour);

        cell.AllowGo(dir);
        neighbour.AllowGo(OppositeDirection(dir));
    }
    public HexCellBehaviour GetNeighbour(HexCellBehaviour cell, HexPassable dir)
    {
        Vector3 vd = cubeNeighboursCoordinates[dir];

        vd += cell.cubeCoordinates;
        if (IsOutOfBounds(vd))
        {
            return(null);
        }
        else
        {
            return(GetCell(vd));
        }
    }
    public HexPassable OppositeDirection(HexPassable dir)
    {
        switch (dir)
        {
        case HexPassable.N: return(HexPassable.S);

        case HexPassable.NE: return(HexPassable.SW);

        case HexPassable.NW: return(HexPassable.SE);

        case HexPassable.S: return(HexPassable.N);

        case HexPassable.SE: return(HexPassable.NW);

        case HexPassable.SW: return(HexPassable.NE);

        default: return(HexPassable.N);
        }
    }
Beispiel #4
0
 public void BlockGo(HexPassable dir)
 {
     _hexPassable &= ~dir;
     MakePassableVisible();
 }
Beispiel #5
0
 public void AllowGo(HexPassable dir)
 {
     _hexPassable |= dir;
     MakePassableVisible();
 }
Beispiel #6
0
 public bool CanGo(HexPassable dir)
 {
     return((dir & _hexPassable) == dir);
 }