CombatHeroGameObject.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. public Quaternion rotation
  19. {
  20. get { return GameObjectPool.own.transform.rotation; }
  21. set { GameObjectPool.own.transform.rotation=value; }
  22. }
  23. private CombatHeroEntity _combatHeroEntity;
  24. private CombatHeroHitPoint _combatHeroHitPoints = new CombatHeroHitPoint();
  25. public void Init(CombatHeroEntity combatHeroEntity, GameObjectPool gameObjectPool)
  26. {
  27. _combatHeroEntity = combatHeroEntity;
  28. GameObjectPool = gameObjectPool;
  29. SetGameObject(gameObjectPool);
  30. }
  31. public void SetGameObject(GameObjectPool gameObjectPool)
  32. {
  33. GameObjectPool = gameObjectPool;
  34. HitPointMono hitPointMonos = GameObjectPool.own.GetComponentInChildren<HitPointMono>(true);
  35. HitPointMono hitPointMono = hitPointMonos;
  36. _combatHeroHitPoints = new CombatHeroHitPoint();
  37. _combatHeroHitPoints.Init(_combatHeroEntity, hitPointMono);
  38. CombatController.currActiveCombat.CombatHeroController.AddHeroHitPoint(_combatHeroEntity.IsEnemy,_combatHeroHitPoints);
  39. }
  40. public void HeroDie()
  41. {
  42. CombatController.currActiveCombat.CombatHeroController.RemoveHeroHitPoint(_combatHeroEntity.IsEnemy,_combatHeroHitPoints);
  43. }
  44. public void SetPosition(Vector3 pos)
  45. {
  46. GameObjectPool.own.transform.position = pos;
  47. }
  48. public T GetILifetCycleHitPoint<T>(string hitPoinName, bool isStandType, bool isIgnoreHind)
  49. where T : ILifetCycleHitPoint
  50. {
  51. return (T)(object)_combatHeroHitPoints;
  52. }
  53. public T GetMainHotPoin<T>(bool isIgnoreHind) where T : ILifetCycleHitPoint
  54. {
  55. return (T)(object)_combatHeroHitPoints;
  56. }
  57. public void Dispose()
  58. {
  59. GObjectPool.Instance.Recycle(GameObjectPool);
  60. }
  61. }