CombatHeroHitPoint.cs 3.0 KB

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