2
0

GameResourceEffect.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // GameResourceEffect.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. #endregion
  16. namespace RobotGameData.Resource
  17. {
  18. /// <summary>
  19. /// an resource element structure with Effect class.
  20. /// When a shader(.fx) file is loaded from the resource manager, it gets stored here.
  21. /// </summary>
  22. public class GameResourceEffect : GameResourceBase
  23. {
  24. #region Fields
  25. Effect effect = null;
  26. #endregion
  27. #region Properties
  28. public Effect Effect
  29. {
  30. get { return effect; }
  31. }
  32. #endregion
  33. /// <summary>
  34. /// Constructor.
  35. /// </summary>
  36. /// <param name="key">key name</param>
  37. /// <param name="assetName">asset name</param>
  38. /// <param name="resource">effect resource</param>
  39. public GameResourceEffect(string key, string assetName, Effect resource)
  40. : base(key, assetName)
  41. {
  42. this.effect = resource;
  43. this.resource = (object)this.effect;
  44. }
  45. protected override void Dispose(bool disposing)
  46. {
  47. if (disposing)
  48. {
  49. if (effect != null)
  50. {
  51. effect.Dispose();
  52. effect = null;
  53. }
  54. }
  55. base.Dispose(disposing);
  56. }
  57. }
  58. }