/// <summary> /// Method for drawing dialog boxes /// </summary> /// <param name="player">Player object</param> private void DrawDialogBoxes(Model.Player player) { //Trigger the drawing dialog boxes if (player.Target != null) { if (player.Target.GetType() == Model.GameModel.FRIENDLY_NPC) { Model.NonPlayerCharacter npc = player.Target as Model.NonPlayerCharacter; if (_inputHandler.DidGetTargetedByLeftClick(_camera.VisualizeRectangle(npc.ThisUnit.Bounds)) && npc.ThisUnit.Bounds.Intersects(player.CollisionArea) && npc.CanInterract) { _conversation.DrawDialog = true; } else if (!npc.ThisUnit.Bounds.Intersects(player.CollisionArea)) { _conversation.DrawDialog = false; } bool isQuestNpc = false; if (npc.UnitId == _gameModel.QuestSystem.ActiveNpc) { isQuestNpc = true; } if (_conversation.DrawDialog) { _conversation.DrawNPCText(player.Target, isQuestNpc); } } } }
//Metod för utritning av QuestLog private void DrawQuestLog() { List <Objective> progress = m_questSystem.ObjectiveList; List <Objective> quest = m_questSystem.CurrentQuest.Objectives; Vector2 position = new Vector2(405, 150); Rectangle textRect = m_camera.VisualizeRectangle(new Rectangle((int)position.X + 8, (int)position.Y + 53, 225, 350)); Rectangle closeCross = GetCloseButton(position.X, position.Y, QLOG); m_spriteBatch.Draw(m_textures[QLOG], position, Color.White); if (m_questSystem.CurrentQuest.Status != Model.QuestSystem.PRE) { m_spriteBatch.DrawString(m_spriteFontSegoeSmall, m_conversation.GetLogMessage(textRect), m_camera.LogicalizeCordinates(textRect.X, textRect.Y), Color.White); int changeRow = 150; for (int i = 0; i < progress.Count; i++) { m_spriteBatch.DrawString(m_spriteFontSegoeSmall, progress[i].Amount + "/" + quest[i].Amount + " - " + quest[i].Name, m_camera.LogicalizeCordinates(textRect.X, textRect.Y + changeRow), Color.White); changeRow += 18; } } if (m_inputHandler.MouseIsOver(new Rectangle((int)position.X, (int)position.Y, m_textures[QLOG].Bounds.Width, m_textures[QLOG].Bounds.Height))) { m_inputHandler.MouseIsOverInterface = true; } if (m_inputHandler.DidGetTargetedByLeftClick(closeCross)) { m_questSystem.IsWatchingQuestLog = false; } }
/// <summary> /// Method for rendering of the world map and the player position /// </summary> internal void DrawWorldMap() { if (_player.IsLookingAtMap) { Vector2 position = new Vector2(_camera.GetScreenRectangle.Width / 2 - _textures[Convert.ToInt32(Texture.WORLD_MAP_BG)].Bounds.Width / 2, _camera.GetScreenRectangle.Height - (_textures[Convert.ToInt32(Texture.WORLD_MAP_BG)].Bounds.Height * 1.25f)); Rectangle mapRect = new Rectangle((int)position.X + 15, (int)position.Y + 30, 500, 500); _spriteBatch.Draw(_textures[Convert.ToInt32(Texture.WORLD_MAP_BG)], position, Color.White); _spriteBatch.Draw(_textures[Convert.ToInt32(Texture.WORLD_MAP)], mapRect, Color.White); _spriteBatch.Draw(_textures[Convert.ToInt32(Texture.PLAYER_POSITION)], new Vector2(mapRect.X + _player.ThisUnit.Bounds.X / 20, mapRect.Y + _player.ThisUnit.Bounds.Y / 20), Color.White); //Fixa med anrop till GeatCloseRec Rectangle closeCross = new Rectangle((int)position.X + _textures[Convert.ToInt32(Texture.WORLD_MAP_BG)].Width - 25, (int)position.Y, 25, 25); if (_inputHandler.MouseIsOver(new Rectangle((int)position.X, (int)position.Y, _textures[Convert.ToInt32(Texture.WORLD_MAP_BG)].Bounds.Width, _textures[Convert.ToInt32(Texture.WORLD_MAP_BG)].Bounds.Height))) { _inputHandler.MouseIsOverInterface = true; } if (_inputHandler.DidGetTargetedByLeftClick(closeCross)) { _player.IsLookingAtMap = false; } } }
//Metod för utritning av interaktionsknappar private void DrawQuestButtons() { //Knappmått int buttonWidth = (int)(270f * 0.27f); int buttonHeight = (int)(100f * 0.26f); //Minskar storleken på en vanlig pratbubbla int textMargin = 7; Color colorOne = Color.White; Color colorTwo = Color.White; string buttonOneText; string buttonTwoText; //Knapprektanglar Rectangle buttonOne = new Rectangle(m_textRect.Right - (buttonWidth * 2), m_textRect.Bottom, buttonWidth, buttonHeight); Rectangle buttonTwo = new Rectangle(m_textRect.Right - buttonWidth, m_textRect.Bottom, buttonWidth, buttonHeight); if (m_questSystem.QuestStatus == Model.QuestSystem.PRE) { buttonOneText = "Accept"; buttonTwoText = "Decline"; m_spriteBatch.Draw(m_dialogueWindow, new Vector2(m_textRect.Right - buttonWidth, m_textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); m_spriteBatch.Draw(m_dialogueWindow, new Vector2(m_textRect.Right - (buttonWidth * 2), m_textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); if (m_inputHandler.MouseIsOver(buttonOne)) { colorOne = Color.Green; if (m_inputHandler.DidGetTargetedByLeftClick(buttonOne)) { m_questSystem.QuestStatus = Model.QuestSystem.MID; } } if (m_inputHandler.MouseIsOver(buttonTwo)) { colorTwo = Color.Red; if (m_inputHandler.DidGetTargetedByLeftClick(buttonTwo)) { m_drawDialog = false; } } m_spriteBatch.DrawString(m_spriteFont, buttonOneText, new Vector2(buttonOne.X + 7, buttonOne.Y + 4), colorOne); } else { if ((m_questSystem.QuestStatus == Model.QuestSystem.MID)) { buttonTwoText = "Okey"; } else { buttonTwoText = "Complete"; textMargin = 4; } if (m_inputHandler.MouseIsOver(buttonTwo)) { colorTwo = Color.Green; if (m_inputHandler.DidGetTargetedByLeftClick(buttonTwo)) { m_drawDialog = false; if (buttonTwoText == "Complete") { m_questSystem.ActivateNextQuest(); } } } m_spriteBatch.Draw(m_dialogueWindow, new Vector2(m_textRect.Right - buttonWidth, m_textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); } m_spriteBatch.DrawString(m_spriteFont, buttonTwoText, new Vector2(buttonTwo.X + textMargin, buttonTwo.Y + 4), colorTwo); }
/// <summary> /// Method for rendering of interaction buttons /// </summary> private void DrawQuestButtons() { //Button properties int buttonWidth = (int)(270f * 0.27f); int buttonHeight = (int)(100f * 0.26f); //Reduce dialog box size int textMargin = 7; Color colorOne = Color.White; Color colorTwo = Color.White; string buttonOneText; string buttonTwoText; //Button rectangles Rectangle buttonOne = new Rectangle(_textRect.Right - (buttonWidth * 2), _textRect.Bottom, buttonWidth, buttonHeight); Rectangle buttonTwo = new Rectangle(_textRect.Right - buttonWidth, _textRect.Bottom, buttonWidth, buttonHeight); if (_questSystem.QuestStatus == Model.QuestSystem.PRE) { buttonOneText = "Accept"; buttonTwoText = "Decline"; _spriteBatch.Draw(_dialogueWindow, new Vector2(_textRect.Right - buttonWidth, _textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); _spriteBatch.Draw(_dialogueWindow, new Vector2(_textRect.Right - (buttonWidth * 2), _textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); if (_inputHandler.MouseIsOver(buttonOne)) { colorOne = Color.Green; if (_inputHandler.DidGetTargetedByLeftClick(buttonOne)) { _questSystem.QuestStatus = Model.QuestSystem.MID; } } if (_inputHandler.MouseIsOver(buttonTwo)) { colorTwo = Color.Red; if (_inputHandler.DidGetTargetedByLeftClick(buttonTwo)) { _drawDialog = false; } } _spriteBatch.DrawString(_spriteFont, buttonOneText, new Vector2(buttonOne.X + 7, buttonOne.Y + 4), colorOne); } else { if ((_questSystem.QuestStatus == Model.QuestSystem.MID)) { buttonTwoText = "Okey"; } else { buttonTwoText = "Complete"; } textMargin = 4; if (_inputHandler.MouseIsOver(buttonTwo)) { colorTwo = Color.Green; if (_inputHandler.DidGetTargetedByLeftClick(buttonTwo)) { _drawDialog = false; if (buttonTwoText == "Complete") { _questSystem.ActivateNextQuest(); } } } _spriteBatch.Draw(_dialogueWindow, new Vector2(_textRect.Right - buttonWidth, _textRect.Bottom), new Rectangle(0, 0, 270, 100), Color.White, 0f, Vector2.Zero, 0.26f, SpriteEffects.None, 0f); } _spriteBatch.DrawString(_spriteFont, buttonTwoText, new Vector2(buttonTwo.X + textMargin, buttonTwo.Y + 4), colorTwo); }
/// <summary> /// Method for drawing NPCs /// </summary> /// <param name="elapsedTime">Elapsed time in milleseconds</param> private void DrawNPC(float elapsedTime) { foreach (Model.NonPlayerCharacter friend in _nonPlayerCharacters) { //Checks wheter the NPC occurs within the camera screen if (friend.ThisUnit.Bounds.Intersects(_camera.GetScreenRectangle)) { friend.CanAddToQuest = true; //Setting the NPC as target on click if (_inputHandler.DidGetTargetedByLeftClick(_camera.VisualizeRectangle(friend.ThisUnit.Bounds)) || _inputHandler.DidGetTargetedByRightClick(_camera.VisualizeRectangle(friend.ThisUnit.Bounds))) { _player.Target = friend; } Vector2 interactPosition = _camera.VisualizeCordinates(friend.ThisUnit.Bounds.X + 10, friend.ThisUnit.Bounds.Y - 24); int bubble = -1; //Drawing dialog box if the NPC ID excists in the XML file for Dialogs if (_conversation.DialogueList.Exists(Message => Message.id == friend.UnitId)) { friend.CanInterract = true; bubble = Convert.ToInt32(Texture.INTERACT); } else if ((_questSystem.QuestList.Exists(Quest => _questSystem.ActiveNpc == friend.UnitId && Quest.Id == _questSystem.CurrentQuest.Id))) { friend.CanInterract = true; if (_questSystem.CurrentQuest.Status == Model.QuestSystem.END) { bubble = Convert.ToInt32(Texture.INTERACT_Q_COMPLETE); } else if (_questSystem.CurrentQuest.Status == Model.QuestSystem.PRE) { bubble = Convert.ToInt32(Texture.INTERACT_Q); } else { bubble = Convert.ToInt32(Texture.INTERACT); } } else { friend.CanInterract = false; } if (friend.CanInterract) { _spriteBatch.Draw(_textures[bubble], new Rectangle((int)interactPosition.X, (int)interactPosition.Y, 30, 30), Color.White); } //Drawing NPC Vector2 npcPosition = _camera.VisualizeCordinates(friend.ThisUnit.Bounds.X + 8, friend.ThisUnit.Bounds.Y + 8); AnimationSystem.Texture animation = 0; if (friend.Type == Model.NonPlayerCharacter.OLD_MAN) { animation = AnimationSystem.Texture.OLD_MAN; } else { animation = AnimationSystem.Texture.CITY_GUARD; } //Drawing target circle DrawTargetCircle(_player, friend); _animationSystem.UpdateAndDraw(elapsedTime, Color.White, npcPosition, friend.UnitState, animation); } else { friend.CanAddToQuest = false; } } }
//Huvudmetod för utritning av spelets grafiska/visuella komponenter internal void DrawAndUpdate(float a_elapsedTime) { //Hämtar spelarObjekt Model.Player player = m_gameModel.m_playerSystem.m_player; //Uppdaterar kamera m_camera.UpdateCamera(); //Påbörjar utritning m_spriteBatch.Begin(); #region Draw //Ritar bakgrund m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerOne, m_camera.GetScreenRectangle, 0f); m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerTwo, m_camera.GetScreenRectangle, 0f); m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexBackgroundLayerThree, m_camera.GetScreenRectangle, 0f); m_inputHandler.MouseIsOverLoot = false; //Ritar Items DrawItems(a_elapsedTime); //Ritar spelare, enemies, NPCs m_unitView.DrawAndUpdateUnits(a_elapsedTime); //Ritar spells DrawSpells(m_gameModel.m_playerSystem.m_spellSystem.ActiveSpells, a_elapsedTime); DrawSpells(m_gameModel.m_enemySystem.m_enemySpellSystem.ActiveSpells, a_elapsedTime); //Ritar förgrund if (m_gameModel.m_level.foregroundVisible) { m_gameModel.m_currentMap.DrawLayer(m_spriteBatch, m_gameModel.m_level.IndexForeground, m_camera.GetScreenRectangle, 0f); } #region Dialogrutor //Triggar utritning av quest meddelanden if (player.Target != null) { if (player.Target.GetType() == Model.GameModel.FRIENDLY_NPC) { Model.Friend npc = player.Target as Model.Friend; if (m_inputHandler.DidGetTargetedByLeftClick(m_camera.VisualizeRectangle(npc.ThisUnit.Bounds)) && npc.ThisUnit.Bounds.Intersects(player.CollisionArea) && npc.CanInterract) { m_conversation.DrawDialog = true; } else if (!npc.ThisUnit.Bounds.Intersects(player.CollisionArea)) { m_conversation.DrawDialog = false; } bool isQuestNpc = false; if (npc.UnitId == m_gameModel.m_questSystem.ActiveNpc) { isQuestNpc = true; } if (m_conversation.DrawDialog) { m_conversation.DrawNPCText(player.Target, isQuestNpc); } } } #endregion //Ritar UserInterface m_UIView.DrawAndUpdate(a_elapsedTime); //Uppdaterar och ritar zonetexter DrawZoneText(); #region Utritning av objektlager (DEBUG) //if (m_inputHandler.PressedAndReleased('V')) //{ // m_showDebug = !m_showDebug; //} //if (m_showDebug) //{ // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexCollision, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexInteraction, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexFriendlyNPC, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexEnemyNPC, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexItems, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexPlayer, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexEnemyZone, m_camera.GetScreenRectangle, 0f); // m_gameModel.m_currentMap.DrawObjectLayer(m_spriteBatch, m_gameModel.m_level.IndexGraveyard, m_camera.GetScreenRectangle, 0f); //} #endregion #endregion m_spriteBatch.End(); //Repeterar uppdatering av kamera (Buggfix) m_camera.UpdateCamera(); //Uppdaterar och spelar spelmusik UpdateMusic(); }
//Metod för utritning av startskärm internal void DrawStartScreen() { m_stopWatch.Start(); PlayStartTheme(); //Ritar start BG DrawImage(SCREEN_START, Vector2.Zero, new Point(1280, 720), 1.0f); #region Animation int y = 0; int x = 10; if (m_stopWatch.ElapsedMilliseconds > 400) { y = 59; x = 192; } if (m_stopWatch.ElapsedMilliseconds > 800) { y = 118; x = 374; } if (m_stopWatch.ElapsedMilliseconds > 1200) { m_stopWatch.Stop(); m_stopWatch.Reset(); } #endregion //Ritar animation bilder m_spriteBatch.Draw(m_screenTextures[SCREEN_ANIMATION_A], new Vector2(23, 260), new Rectangle(0, y, 265, 59), Color.White); m_spriteBatch.Draw(m_screenTextures[SCREEN_ANIMATION_B], new Vector2(154, 352), new Rectangle(x, 0, 170, 247), Color.White); if (!m_showOptions && !m_showCredits) { //Ritar starmeny DrawImage(SCREEN_BORDER_BG, new Vector2(727, 0), new Point(300, 720), 1.0f); DrawButton(BUTTONS_START_MENU, new Vector2(750, 325), new Point(512, 512), 0.5f); //Skapar knapp area för startmeny Rectangle newGameArea = new Rectangle(750, 325, 250, 40); Rectangle optionsArea = new Rectangle(750, 404, 250, 40); Rectangle creditsArea = new Rectangle(750, 450, 250, 30); Rectangle exitArea = new Rectangle(750, 485, 250, 30); #region Inputhantering för startmeny if (m_inputHandler.MouseIsOver(newGameArea)) { DrawButton(BUTTONS_NEWGAME_SELECTED, new Vector2(750, 319), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.MENU_BUTTON_HOVER); if (m_inputHandler.DidGetTargetedByLeftClick(newGameArea)) { PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT_B); m_didPressNewGame = true; } } else if (m_inputHandler.MouseIsOver(optionsArea)) { DrawButton(BUTTONS_OPTIONS_SELECTED, new Vector2(750, 396), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.MENU_BUTTON_HOVER); if (m_inputHandler.DidGetTargetedByLeftClick(optionsArea)) { PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT); m_showOptions = true; } } else if (m_inputHandler.MouseIsOver(creditsArea)) { DrawButton(BUTTONS_CREDITS_SELECTED, new Vector2(750, 434), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.MENU_BUTTON_HOVER); if (m_inputHandler.DidGetTargetedByLeftClick(creditsArea)) { PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT); m_showCredits = true; } } else if (m_inputHandler.MouseIsOver(exitArea)) { DrawButton(BUTTONS_EXIT_SELECTED, new Vector2(750, 473), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.MENU_BUTTON_HOVER); if (m_inputHandler.DidGetTargetedByLeftClick(exitArea)) { m_didPressExit = true; } } else { m_didHover = false; } #endregion } else if (m_showOptions) { DrawOptionScreen(new Vector2(727, 0)); } else { DrawCreditsScreen(); } }
/// <summary> /// Method for drawing the start screen /// </summary> internal void DrawStartScreen() { _stopWatch.Start(); PlayStartTheme(); //Startscreen background DrawImage(Screen.SCREEN_START, Vector2.Zero, new Point(1280, 720), 1.0f); #region Startscreen animation int y = 0; int x = 10; if (_stopWatch.ElapsedMilliseconds > 400) { y = 59; x = 192; } if (_stopWatch.ElapsedMilliseconds > 800) { y = 118; x = 374; } if (_stopWatch.ElapsedMilliseconds > 1200) { _stopWatch.Stop(); _stopWatch.Reset(); } _spriteBatch.Draw(_screenContent.Screens[Convert.ToInt32(Screen.SCREEN_ANIMATION_A)], new Vector2(23, 260), new Rectangle(0, y, 265, 59), Color.White); _spriteBatch.Draw(_screenContent.Screens[Convert.ToInt32(Screen.SCREEN_ANIMATION_B)], new Vector2(154, 352), new Rectangle(x, 0, 170, 247), Color.White); #endregion if (!DidPressOptions && !DidShowCredits) { //Drawing startmenu DrawImage(Screen.SCREEN_BORDER_BG, new Vector2(727, 0), new Point(300, 720), 1.0f); DrawButton(Button.BUTTONS_START_MENU, new Vector2(750, 325), new Point(512, 512), 0.5f); //Button areas for startmenu Rectangle newGameArea = new Rectangle(750, 325, 250, 40); Rectangle optionsArea = new Rectangle(750, 404, 250, 40); Rectangle creditsArea = new Rectangle(750, 450, 250, 30); Rectangle exitArea = new Rectangle(750, 485, 250, 30); #region Inputhandling for startmenu if (_inputHandler.MouseIsOver(newGameArea)) { DrawButton(Button.BUTTONS_NEWGAME_SELECTED, new Vector2(750, 319), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_HOVER); if (_inputHandler.DidGetTargetedByLeftClick(newGameArea)) { PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT_B); DidPressNewGame = true; } } else if (_inputHandler.MouseIsOver(optionsArea)) { DrawButton(Button.BUTTONS_OPTIONS_SELECTED, new Vector2(750, 396), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_HOVER); if (_inputHandler.DidGetTargetedByLeftClick(optionsArea)) { PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT); DidPressOptions = true; } } else if (_inputHandler.MouseIsOver(creditsArea)) { DrawButton(Button.BUTTONS_CREDITS_SELECTED, new Vector2(750, 434), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_HOVER); if (_inputHandler.DidGetTargetedByLeftClick(creditsArea)) { PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT); DidShowCredits = true; } } else if (_inputHandler.MouseIsOver(exitArea)) { DrawButton(Button.BUTTONS_EXIT_SELECTED, new Vector2(750, 473), new Point(512, 100), 0.5f); PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_HOVER); if (_inputHandler.DidGetTargetedByLeftClick(exitArea)) { DidPressExit = true; } } else { _didHover = false; } #endregion } else if (DidPressOptions) { DrawOptionScreen(new Vector2(727, 0)); } else { DrawCreditsScreen(); } }
//Metod för utritning av friendly NPCs private void DrawFriendlyNPC(float a_elapsedTime) { foreach (Model.Friend friend in m_friends) { //Kollar att npcn är med på skärmen if (friend.ThisUnit.Bounds.Intersects(m_camera.GetScreenRectangle)) { friend.CanAddToQuest = true; //Om man klickar på FNPC sätts den till spelarens target if (m_inputHandler.DidGetTargetedByLeftClick(m_camera.VisualizeRectangle(friend.ThisUnit.Bounds)) || m_inputHandler.DidGetTargetedByRightClick(m_camera.VisualizeRectangle(friend.ThisUnit.Bounds))) { m_player.Target = friend; } Vector2 interactPosition = m_camera.VisualizeCordinates(friend.ThisUnit.Bounds.X + 10, friend.ThisUnit.Bounds.Y - 24); int bubble = -1; //Ritar ut pratbubbla om NPCns ID ingår i XML filen för konversationer if (m_conversation.m_dialogueList.Exists(Message => Message.id == friend.UnitId)) { friend.CanInterract = true; bubble = INTERACT; } else if ((m_questSystem.QuestList.Exists(Quest => m_questSystem.ActiveNpc == friend.UnitId && Quest.Id == m_questSystem.CurrentQuest.Id))) { friend.CanInterract = true; if (m_questSystem.CurrentQuest.Status == Model.QuestSystem.END) { bubble = INTERACT_Q_COMPLETE; } else if (m_questSystem.CurrentQuest.Status == Model.QuestSystem.PRE) { bubble = INTERACT_Q; } else { bubble = INTERACT; } } else { friend.CanInterract = false; } if (friend.CanInterract) { m_spriteBatch.Draw(m_textures[bubble], new Rectangle((int)interactPosition.X, (int)interactPosition.Y, 30, 30), Color.White); } //Ritar NPC Vector2 npcPosition = m_camera.VisualizeCordinates(friend.ThisUnit.Bounds.X + 8, friend.ThisUnit.Bounds.Y + 8); int animation = 0; if (friend.Type == Model.Friend.OLD_MAN) { animation = AnimationSystem.NPC_OLD_MAN; } else { animation = AnimationSystem.CITY_GUARD; } //Ritar target ringen. DrawTargetCircle(m_player, friend); m_animationSystem.UpdateAndDraw(a_elapsedTime, Color.White, npcPosition, friend.UnitState, animation); } else { friend.CanAddToQuest = false; } } }