public void UpdateGui(GuiManager gui_manager, float dt) { //Updates all elements from the list in the gui manager Iterator <IGuiElement> elementIterator; elementIterator = new LinkedListIterator <IGuiElement>(gui_manager.elements); elementIterator.getCurrent().Visit(() => Do.Nothing(), (button) => button.Update(this, dt)); while (elementIterator.hasNext()) { elementIterator.moveNext().Visit(() => Do.Nothing(), button => button.Update(this, dt)); } }
public void DrawGui(GuiManager gui_manager) { //Draws all elements from the list in the guimanager Iterator <IGuiElement> elementIterator; elementIterator = new LinkedListIterator <IGuiElement>(gui_manager.elements); elementIterator.getCurrent().Visit(() => Do.Nothing(), (button) => button.Draw(this)); while (elementIterator.getCurrent().Visit(() => false, (element) => true)) { elementIterator.moveNext().Visit(() => Do.Nothing(), button => button.Draw(this)); } }
public static void PlaySong(ILinkedList <Note> song) { Iterator <Note> SongIterartor = new LinkedListIterator <Note>(song); SongIterartor.getCurrent().Visit(() => Do.Nothing(), (note) => note.Visit(() => note.Play(), (duration) => Thread.Sleep(duration))); while (SongIterartor.hasNext()) { SongIterartor.moveNext().Visit(() => Console.WriteLine("!!!______END__SONG______!!!"), (note) => note.Visit(() => note.Play(), (duration) => Thread.Sleep((int)duration))); } }