CombatHeroHitPoint.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 CombatHeroEntity 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 { return _hitPointMono.transform.position; }
  20. }
  21. private HitPointMono _hitPointMono;
  22. public T This<T>()
  23. {
  24. return (T)(object)this;
  25. }
  26. public void Init(CombatHeroEntity combatHeroEntity, HitPointMono hitPointMono)
  27. {
  28. this.combatHeroEntity = combatHeroEntity;
  29. _hitPointMono = hitPointMono;
  30. SpecialDotMono[] specialDotMonos = combatHeroEntity.combatHeroGameObject.GameObjectPool.own
  31. .GetComponentsInChildren<SpecialDotMono>(true);
  32. for (int i = 0; i < specialDotMonos.Length; i++)
  33. {
  34. SpecialDotMono specialDotMono = specialDotMonos[i];
  35. SpecialDotInfo specialDotInfo = new SpecialDotInfo();
  36. specialDotInfo.dotName = specialDotMono.DotName;
  37. specialDotInfo.targetTran = specialDotMono.transform;
  38. specialDotInfo.followSkeleton = specialDotMono.followSkeleton;
  39. specialDotInfo.heroEntity = combatHeroEntity;
  40. allSpecialDotInfo.Add(specialDotInfo);
  41. }
  42. MinSpecialDotInfo = new SpecialDotInfo();
  43. MinSpecialDotInfo.targetTran = combatHeroEntity.combatHeroGameObject.GameObjectPool.own.transform;
  44. MinSpecialDotInfo.heroEntity = combatHeroEntity;
  45. }
  46. public SpecialDotInfo GetSpecialDotInfo(string specialDotName)
  47. {
  48. SpecialDotInfo specialDotInfo = MinSpecialDotInfo;
  49. for (int i = 0; i < allSpecialDotInfo.Count; i++)
  50. {
  51. if (allSpecialDotInfo[i].dotName == specialDotName)
  52. {
  53. specialDotInfo = allSpecialDotInfo[i];
  54. }
  55. }
  56. if (specialDotInfo.followSkeleton)
  57. {
  58. combatHeroEntity.combatHeroAnimtion.SetSpecialDotMonoFollow(specialDotInfo);
  59. }
  60. return specialDotInfo;
  61. }
  62. }
  63. }