/// <summary> /// metodo para acceder al level. /// </summary> /// <param name="level"> objeto level al que se accede. </param> public override void Visit(Level level) { if (level.ScreenList.Count >= 1) { this.LastScreen = level.ScreenList[level.ScreenList.Count - 1]; } try { string name = this.tag.AttributeList["Name"].Value; int positionY = Int32.Parse(this.tag.AttributeList["PositionY"].Value); int positionX = Int32.Parse(this.tag.AttributeList["PositionX"].Value); int length = Int32.Parse(this.tag.AttributeList["Length"].Value); int width = Int32.Parse(this.tag.AttributeList["Width"].Value); string imagePath = this.tag.AttributeList["ImagePath"].Value; IXML exit = new ExitButton(name, positionY, positionX, length, width, this.LastScreen, imagePath); this.LastScreen.Add(exit); } catch (Exception) { string message = "there was an error while fetching data from the XML file"; throw new NotFoundOnXMLException(message); } }
/// <summary> /// metodo que dibuja un ExitButton en Unity. /// </summary> /// <param name="exitButton"> ExitButton a dibujar. </param> public void RenderExitButton(ExitButton exitButton) { string buttonId = this.adapter.CreateButton((int)exitButton.PositionX, (int)exitButton.PositionY, (int)exitButton.Width, (int)exitButton.Length, "#BC2FA864", exitButton.Action); this.adapter.SetImage(buttonId, exitButton.ImagePath); }