ParticleInfoReader.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // ParticleInfoReader.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 Microsoft.Xna.Framework;
  13. using Microsoft.Xna.Framework.Content;
  14. using Microsoft.Xna.Framework.Graphics;
  15. using TRead = MovipaLibrary.ParticleInfo;
  16. #endregion
  17. namespace MovipaLibrary
  18. {
  19. /// <summary>
  20. /// This class restores the xnb file converted by the content pipeline
  21. /// to the value of ParticleInfoReader.
  22. /// This ContentTypeReader must be the same as the runtime
  23. /// specified in ContentTypeWriter that was used to write the xnb
  24. /// whose type is ParticleInfoReader.
  25. ///
  26. /// ContentPipelineで変換されたxnbファイルをParticleInfoReaderの値に復元します。
  27. /// このContentTypeReaderはParticleInfoReader型のxnbを書き込む際に使用した
  28. /// ContentTypeWriterで指定されたランタイムと同じである必要があります。
  29. /// </summary>
  30. public class ParticleInfoReader : ContentTypeReader<TRead>
  31. {
  32. /// <summary>
  33. /// Reads ParticleInfo from the xnb file.
  34. ///
  35. /// xnbファイルからParticleInfoを読み込みます。
  36. /// </summary>
  37. protected override TRead Read(ContentReader input, TRead existingInstance)
  38. {
  39. TRead info = new TRead();
  40. // Reads AnimationInfo.
  41. //
  42. // AnimationInfoを読み込みます。
  43. AnimationInfoReader.ReadAnimationInfo(input, info);
  44. // Reads ParticleInfo.
  45. //
  46. // ParticleInfoを読み込みます。
  47. info.ParticleTexture = input.ReadString();
  48. info.ParticleSize = input.ReadSingle();
  49. info.ParticleMax = input.ReadUInt32();
  50. info.ParticleGenerateCount = input.ReadUInt32();
  51. info.ParticleJumpPower = input.ReadSingle();
  52. info.ParticleMoveSpeed = input.ReadSingle();
  53. info.ParticleBoundRate = input.ReadSingle();
  54. info.ParticleGravity = input.ReadSingle();
  55. info.CameraUpVector = input.ReadObject<Vector3>();
  56. info.CameraPosition = input.ReadObject<Vector3>();
  57. info.CameraLookAt = input.ReadObject<Vector3>();
  58. return info;
  59. }
  60. }
  61. }