NpcScreen.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // NpcScreen.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Text;
  13. using Microsoft.Xna.Framework;
  14. using Microsoft.Xna.Framework.Graphics;
  15. using Microsoft.Xna.Framework.Content;
  16. using RolePlayingGameData;
  17. #endregion
  18. namespace RolePlaying
  19. {
  20. /// <summary>
  21. /// Display of conversation dialog between the player and the npc
  22. /// </summary>
  23. abstract class NpcScreen<T> : DialogueScreen where T : Character
  24. {
  25. protected MapEntry<T> mapEntry = null;
  26. protected Character character = null;
  27. #region Initialization
  28. /// <summary>
  29. /// Create a new NpcScreen object.
  30. /// </summary>
  31. /// <param name="mapEntry"></param>
  32. public NpcScreen(MapEntry<T> mapEntry) : base()
  33. {
  34. if (mapEntry == null)
  35. {
  36. throw new ArgumentNullException("mapEntry");
  37. }
  38. this.mapEntry = mapEntry;
  39. this.character = mapEntry.Content as Character;
  40. if (this.character == null)
  41. {
  42. throw new ArgumentNullException(
  43. "NpcScreen requires a MapEntry with a character.");
  44. }
  45. TitleText = character.Name;
  46. }
  47. #endregion
  48. }
  49. }