package pathgame.gameplay.menu;

import java.util.function.BiConsumer;
import java.util.function.Consumer;
import pathgame.gameplay.Gamestate;
import pathgame.gameplay.Level;

public class MenuButton
{
    private final String name;
    private final BiConsumer<Gamestate, Level> r;
    
    public MenuButton(String name, BiConsumer<Gamestate, Level> r)
    {
        this.name = name;
        this.r = r;
    }
    
    public MenuButton(String name, Consumer<Gamestate> r)
    {
        this(name, (gamestate, level) -> r.accept(gamestate));
    }

    public String getName()
    {
        return name;
    }
    
    public void run(Gamestate gamestate, Level level)
    {
        r.accept(gamestate, level);
    }
}
