WeaponData.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. using GameFramework.DataTable;
  8. using System;
  9. using UnityEngine;
  10. namespace MetaClient
  11. {
  12. [Serializable]
  13. public class WeaponData : AccessoryObjectData
  14. {
  15. [SerializeField]
  16. private int m_Attack = 0;
  17. [SerializeField]
  18. private float m_AttackInterval = 0f;
  19. [SerializeField]
  20. private int m_BulletId = 0;
  21. [SerializeField]
  22. private float m_BulletSpeed = 0f;
  23. [SerializeField]
  24. private int m_BulletSoundId = 0;
  25. public WeaponData(int entityId, int typeId, int ownerId, CampType ownerCamp)
  26. : base(entityId, typeId, ownerId, ownerCamp)
  27. {
  28. IDataTable<DRWeapon> dtWeapon = GameEntry.DataTable.GetDataTable<DRWeapon>();
  29. DRWeapon drWeapon = dtWeapon.GetDataRow(TypeId);
  30. if (drWeapon == null)
  31. {
  32. return;
  33. }
  34. m_Attack = drWeapon.Attack;
  35. m_AttackInterval = drWeapon.AttackInterval;
  36. m_BulletId = drWeapon.BulletId;
  37. m_BulletSpeed = drWeapon.BulletSpeed;
  38. m_BulletSoundId = drWeapon.BulletSoundId;
  39. }
  40. /// <summary>
  41. /// 攻击力。
  42. /// </summary>
  43. public int Attack
  44. {
  45. get
  46. {
  47. return m_Attack;
  48. }
  49. }
  50. /// <summary>
  51. /// 攻击间隔。
  52. /// </summary>
  53. public float AttackInterval
  54. {
  55. get
  56. {
  57. return m_AttackInterval;
  58. }
  59. }
  60. /// <summary>
  61. /// 子弹编号。
  62. /// </summary>
  63. public int BulletId
  64. {
  65. get
  66. {
  67. return m_BulletId;
  68. }
  69. }
  70. /// <summary>
  71. /// 子弹速度。
  72. /// </summary>
  73. public float BulletSpeed
  74. {
  75. get
  76. {
  77. return m_BulletSpeed;
  78. }
  79. }
  80. /// <summary>
  81. /// 子弹声音编号。
  82. /// </summary>
  83. public int BulletSoundId
  84. {
  85. get
  86. {
  87. return m_BulletSoundId;
  88. }
  89. }
  90. }
  91. }