QuestNpc.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // QuestNpc.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 Microsoft.Xna.Framework.Content;
  12. #endregion
  13. namespace RolePlayingGameData
  14. {
  15. /// <summary>
  16. /// An NPC that does not fight and does not join the party.
  17. /// </summary>
  18. public class QuestNpc : Character
  19. {
  20. #region Dialogue Data
  21. /// <summary>
  22. /// The dialogue that the Npc says when it is greeted in the world.
  23. /// </summary>
  24. private string introductionDialogue;
  25. /// <summary>
  26. /// The dialogue that the Npc says when it is greeted in the world.
  27. /// </summary>
  28. public string IntroductionDialogue
  29. {
  30. get { return introductionDialogue; }
  31. set { introductionDialogue = value; }
  32. }
  33. #endregion
  34. #region Content Type Reader
  35. /// <summary>
  36. /// Read a QuestNpc object from the content pipeline.
  37. /// </summary>
  38. public class QuestNpcReader : ContentTypeReader<QuestNpc>
  39. {
  40. protected override QuestNpc Read(ContentReader input,
  41. QuestNpc existingInstance)
  42. {
  43. QuestNpc questNpc = existingInstance;
  44. if (questNpc == null)
  45. {
  46. questNpc = new QuestNpc();
  47. }
  48. input.ReadRawObject<Character>(questNpc as Character);
  49. questNpc.IntroductionDialogue = input.ReadString();
  50. return questNpc;
  51. }
  52. }
  53. #endregion
  54. }
  55. }