コード例 #1
0
    /// <summary>
    /// Sets the value of the map at the given location.
    /// If the value is outside the map, this function does nothing.
    /// </summary>
    public void SetMapAt(Location l, bool value)
    {
        int x = GetXValue(l.X),
            y = GetYValue(l.Y);

        //If the position is outside the level map, don't do anything.
        if (!SizeX.Inside(x) || !SizeY.Inside(y))
        {
            return;
        }

        //Otherwise, set the normal value.
        Map[x, y] = value;
    }
コード例 #2
0
    /// <summary>
    /// Gets the value of the map at the given location.
    /// </summary>
    public bool GetMapAt(Location l)
    {
        int x = GetXValue(l.X),
            y = GetYValue(l.Y);

        //If the position is outside the level map, return the default value.
        if (!SizeX.Inside(x) || !SizeY.Inside(y))
        {
            return(OutsideLevelValue);
        }

        //Otherwise, return the normal value.
        return(Map[x, y]);
    }