CombatHeroHitPoint.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System.Collections.Generic;
  2. using Fort23.UTool;
  3. using GameTimeLine.CustomizeTimeLogic;
  4. using UnityEngine;
  5. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  6. namespace GameLogic.Combat.Hero
  7. {
  8. public class CombatHeroHitPoint : ILifetCycleHitPoint
  9. {
  10. public List<SpecialDotInfo> allSpecialDotInfo = new List<SpecialDotInfo>();
  11. public ShowBaiscEntity combatHeroEntity;
  12. public SpecialDotInfo MinSpecialDotInfo;
  13. private List<ParticleSystemPool> _loopFx = new List<ParticleSystemPool>();
  14. public bool IsHide { get; set; }
  15. public ILifeCycle IfLifeCycle
  16. {
  17. get { return combatHeroEntity; }
  18. }
  19. public Vector3 Position
  20. {
  21. get
  22. {
  23. if (_hitPointMono != null)
  24. {
  25. return _hitPointMono.transform.position;
  26. }
  27. else
  28. {
  29. return combatHeroEntity.dotPos;
  30. }
  31. }
  32. }
  33. private HitPointMono _hitPointMono;
  34. public T This<T>()
  35. {
  36. return (T)(object)this;
  37. }
  38. public void Init(ShowBaiscEntity combatHeroEntity, HitPointMono hitPointMono)
  39. {
  40. this.combatHeroEntity = combatHeroEntity;
  41. _hitPointMono = hitPointMono;
  42. SpecialDotMono[] specialDotMonos = combatHeroEntity.combatHeroGameObject.GameObjectPool.own
  43. .GetComponentsInChildren<SpecialDotMono>(true);
  44. for (int i = 0; i < specialDotMonos.Length; i++)
  45. {
  46. SpecialDotMono specialDotMono = specialDotMonos[i];
  47. SpecialDotInfo specialDotInfo = new SpecialDotInfo();
  48. specialDotInfo.dotName = specialDotMono.DotName;
  49. specialDotInfo.targetTran = specialDotMono.transform;
  50. specialDotInfo.followSkeleton = specialDotMono.followSkeleton;
  51. specialDotInfo.heroEntity = combatHeroEntity;
  52. allSpecialDotInfo.Add(specialDotInfo);
  53. }
  54. MinSpecialDotInfo = new SpecialDotInfo();
  55. MinSpecialDotInfo.targetTran = combatHeroEntity.combatHeroGameObject.GameObjectPool.own.transform;
  56. MinSpecialDotInfo.heroEntity = combatHeroEntity;
  57. }
  58. public void Update(float t)
  59. {
  60. for (int i = 0; i < allSpecialDotInfo.Count; i++)
  61. {
  62. if (allSpecialDotInfo[i].followSkeleton)
  63. {
  64. combatHeroEntity.combatHeroAnimtion.SetSpecialDotMonoFollow(allSpecialDotInfo[i]);
  65. }
  66. }
  67. }
  68. public SpecialDotInfo GetSpecialDotInfo(string specialDotName)
  69. {
  70. SpecialDotInfo specialDotInfo = MinSpecialDotInfo;
  71. for (int i = 0; i < allSpecialDotInfo.Count; i++)
  72. {
  73. if (allSpecialDotInfo[i].dotName == specialDotName)
  74. {
  75. specialDotInfo = allSpecialDotInfo[i];
  76. }
  77. }
  78. return specialDotInfo;
  79. }
  80. public void AddLoopFx(ParticleSystemPool particleSystemPool)
  81. {
  82. _loopFx.Add(particleSystemPool);
  83. }
  84. public bool IsLoopFx(string fxName)
  85. {
  86. for (int i = 0; i < _loopFx.Count; i++)
  87. {
  88. if(_loopFx[i].fxName.Equals(fxName))
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. public void RemoveLoopFx(ParticleSystemPool particleSystemPool)
  96. {
  97. _loopFx.Remove(particleSystemPool);
  98. }
  99. }
  100. }