I am trying to create a menu system and i am storing the menus in stacks once they have already been visited. Im trying to use Stack.Peek() to basically say: if menuName = menuStack.Peek, then continue.
menus have a drawRectangle, sprite, and Menuname enumeration associated with them, and all menus are child classes of the Menu class.
public static void GoToMenu(MenuName menuName)
{
Stack<Menu> menuStack = new Stack<Menu>();
Stack<Menu> tempStack = new Stack<Menu>();
if(menuStack.Peek() = MainMenu){
}
}
More or less, if menuStack.Peek returns a mainMenu object. How do i check that?
i just really dont know how to read menuStack.Peek(). I dont know how to apply it to an if statement to check if it equals a mainmenu object, a pausemenu object or whatever.