CombatHeroGameObject.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Fort23.UTool;
  5. using GameLogic.Combat.CombatTool;
  6. using GameLogic.Combat.Hero;
  7. using GameTimeLine.CustomizeTimeLogic;
  8. using UnityEngine;
  9. using Utility;
  10. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  11. public class CombatHeroGameObject: IDisposable
  12. {
  13. public GameObjectPool GameObjectPool;
  14. public Vector3 position
  15. {
  16. get { return GameObjectPool.own.transform.position; }
  17. }
  18. private CombatHeroEntity _combatHeroEntity;
  19. private CombatHeroHitPoint _combatHeroHitPoints = new CombatHeroHitPoint();
  20. public void Init(CombatHeroEntity combatHeroEntity, GameObjectPool gameObjectPool)
  21. {
  22. _combatHeroEntity = combatHeroEntity;
  23. GameObjectPool = gameObjectPool;
  24. SetGameObject(gameObjectPool);
  25. }
  26. public void SetGameObject(GameObjectPool gameObjectPool)
  27. {
  28. GameObjectPool = gameObjectPool;
  29. HitPointMono hitPointMonos = GameObjectPool.own.GetComponentInChildren<HitPointMono>(true);
  30. HitPointMono hitPointMono = hitPointMonos;
  31. _combatHeroHitPoints = new CombatHeroHitPoint();
  32. _combatHeroHitPoints.Init(_combatHeroEntity, hitPointMono);
  33. CombatController.currActiveCombat.CombatHeroController.AddHeroHitPoint(_combatHeroEntity.IsEnemy,_combatHeroHitPoints);
  34. }
  35. public void SetPosition(Vector3 pos)
  36. {
  37. GameObjectPool.own.transform.position = pos;
  38. }
  39. public T GetILifetCycleHitPoint<T>(string hitPoinName, bool isStandType, bool isIgnoreHind)
  40. where T : ILifetCycleHitPoint
  41. {
  42. return (T)(object)_combatHeroHitPoints;
  43. }
  44. public T GetMainHotPoin<T>(bool isIgnoreHind) where T : ILifetCycleHitPoint
  45. {
  46. return (T)(object)_combatHeroHitPoints;
  47. }
  48. public void Dispose()
  49. {
  50. CombatController.currActiveCombat.CombatHeroController.RemoveHeroHitPoint(_combatHeroEntity.IsEnemy,_combatHeroHitPoints);
  51. GameObjectPool?.Dispose();
  52. }
  53. }