Exemple #1
0
        private bool IsLayerCellPassable(int index, int x, int y)
        {
            ICellMap   layer  = _layers[index];
            Vector2Int offset = _layerOffsets[index];

            int shiftedX = x - offset.X;
            int shiftedY = y - offset.Y;

            if (!layer.IsInBounds(shiftedX, shiftedY))
            {
                return(true);
            }
            else
            {
                bool layerIsPassable = layer.IsPassable(shiftedX, shiftedY);
                return(layerIsPassable);
            }
        }
Exemple #2
0
        private void UpdateCellSurroundings(ICellMap map, int[,] matrix, int x, int y, int d, NeighbourMode neighbourMode)
        {
            foreach (var step in Steps.GetSteps(neighbourMode))
            {
                int xNew = x + step.X;
                int yNew = y + step.Y;

                if (!map.IsInBounds(xNew, yNew))
                {
                    continue;
                }

                if (map.IsPassable(xNew, yNew) && matrix[xNew, yNew] == -1)
                {
                    matrix[xNew, yNew] = d;
                    OnCellViewedEvent?.Invoke(this, xNew, yNew, d);
                }
            }
        }
Exemple #3
0
 public bool IsInBounds(int x, int y)
 {
     // Use only layerBase
     return(_layerBase.IsInBounds(x, y));
 }