Exemplo n.º 1
0
    public static bool IsType <T>(this Container2D <T> cont, int x, int y, GridType type)
        where T : IGridSpace
    {
        T space;

        if (cont.TryGetValue(x, y, out space))
        {
            return(type.Equals(cont[x, y].GetGridType()));
        }
        return(type == GridType.NULL);
    }
Exemplo n.º 2
0
    public static void MergeIn(this Container2D <GenSpace> arr, int x, int y, GenDeploy deploy, Theme theme, GridType type = GridType.Floor, bool typeOnlyDefault = true, bool themeOnlyDefault = false)
    {
        GenSpace space;

        if (!arr.TryGetValue(x, y, out space))
        {
            space     = new GenSpace(type, theme, x, y);
            arr[x, y] = space;
        }
        else
        {
            if (!themeOnlyDefault)
            {
                space.Theme = theme;
            }
            if (!typeOnlyDefault)
            {
                space.Type = type;
            }
        }
        space.AddDeploy(deploy, x, y);
    }