Ejemplo n.º 1
0
    void CheckAboveBelowBuildingPositions(GridIndex index, ref List <GridIndex> indexList)
    {
        if (index == null)
        {
            throw new ArgumentNullException("index");
        }
        if (indexList == null)
        {
            throw new ArgumentNullException("indexList");
        }

        // Only checking the front plane for this (Z = 0)
        if (index.Y != Constants.GridSurfaceY - 1)
        {
            GridIndex IndexAbove = index.GetAbove();
            if (IndexAbove.IsValid() && (_GridData[IndexAbove.X, IndexAbove.Y, 0].Occupied == false))
            {
                if (indexList.Contains(IndexAbove) == false)
                {
                    indexList.Add(IndexAbove);
                }
            }
        }

        if (index.Y != Constants.GridSurfaceY)
        {
            GridIndex IndexBelow = index.GetBelow();
            if (IndexBelow.IsValid() && (_GridData[IndexBelow.X, IndexBelow.Y, 0].Occupied == false))
            {
                if (indexList.Contains(IndexBelow) == false)
                {
                    indexList.Add(IndexBelow);
                }
            }
        }
    }