EffectData.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System;
  5. public enum EffectFollowType
  6. {
  7. Effect_Follow_None = 0, //不更随
  8. Effect_Follow_Self = 1, //更随自身
  9. Effect_Follow_Target = 2, //更随目标
  10. Effect_Follow_Camera_Back = 3, //跟随相机,底层渲染,一般全屏特效使用
  11. Effect_Follow_Bullet = 4, //更随子弹
  12. Effect_Follow_Camera_Normal = 5, //跟随相机
  13. Effect_Follow_Self_Bloodbar = 6, //跟随自身血条
  14. Effect_Follow_Target_Bloodbar = 7, //跟随目标血条
  15. Effect_Follow_Self_Floor = 8, //跟随自身贴地
  16. Effect_Follow_Target_Floor = 9, //跟随目标贴地
  17. }
  18. public enum EffectTargetType
  19. {
  20. Effect_Target_None = 0,
  21. Effect_Target_Self = 1,
  22. Effect_Target_Target = 2,
  23. Effect_Target_Bullet = 3,
  24. Effect_Target_Self_Floor = 4,
  25. Effect_Target_Target_Floor = 5,
  26. Effect_Target_To_Self = 6,
  27. Effect_Self_To_Target = 7,
  28. }
  29. public enum EffectType
  30. {
  31. EffectType_None = 0,
  32. EffectType_Fly = 1,
  33. EffectType_Summon = 2,
  34. EffectType_Ball = 3,
  35. EffectType_Common = 4,
  36. }
  37. public enum EffectFlyType
  38. {
  39. EffectFlyType_None = 0,
  40. }
  41. public enum EffectHitType
  42. {
  43. EffectHitType_Destroy = 0,
  44. EffectHitType_Boom = 1,
  45. EffectHitType_Bebound = 2,
  46. EffectHitType_Through = 3,
  47. }
  48. public class EffectData
  49. {
  50. public int id;
  51. public float lifeTime;
  52. public float delay;
  53. public EffectFollowType followTargetType;
  54. public EffectTargetType targetType;
  55. public string targetObjName;
  56. public string effect;
  57. public Vector3 rot = Vector3.zero;
  58. public bool valid = false;
  59. public EffectData(int id)
  60. {
  61. valid = false;
  62. if (id == 0) return;
  63. Dictionary<string, string> dic = ConfigMgr.Instance.getLine(id, Config.EffectCfgName);
  64. if (dic != null)
  65. {
  66. this.id = id;
  67. this.effect = dic["Effect"];
  68. this.targetObjName = dic["Link"];
  69. if (dic.ContainsKey("LifeTime"))
  70. {
  71. float.TryParse(dic["LifeTime"], out this.lifeTime);
  72. }
  73. if (dic.ContainsKey("FollowType"))
  74. {
  75. followTargetType = (EffectFollowType)int.Parse(dic["FollowType"]);
  76. }
  77. else
  78. {
  79. followTargetType = EffectFollowType.Effect_Follow_Self;
  80. }
  81. if (dic.ContainsKey("TargetType"))
  82. {
  83. targetType = (EffectTargetType)int.Parse(dic["TargetType"]);
  84. }
  85. else
  86. {
  87. targetType = EffectTargetType.Effect_Target_Self;
  88. }
  89. if(dic.ContainsKey("Rot"))
  90. {
  91. rot = StringUtil.convertVector3(dic["Rot"]);
  92. }
  93. valid = true;
  94. }
  95. else
  96. {
  97. DebugHelper.LogWarning("特效ID {0} 不存在", id);
  98. }
  99. }
  100. }