12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Core.Triiger;
- using Fort23.UTool;
- using GameLogic.Combat.CombatTool;
- using GameLogic.Combat.Hero;
- using GameTimeLine.CustomizeTimeLogic;
- using UnityEngine;
- using Utility;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- public class CombatHeroGameObject : IDisposable
- {
- public GameObjectPool GameObjectPool;
- public Transform transform
- {
- get { return GameObjectPool.own.transform; }
- }
- public Vector3 position
- {
- get { return GameObjectPool.own.transform.position; }
- }
- public Quaternion rotation
- {
- get { return GameObjectPool.own.transform.rotation; }
- set { GameObjectPool.own.transform.rotation = value; }
- }
- private CombatHeroEntity _combatHeroEntity;
- private CombatHeroHitPoint _combatHeroHitPoints = new CombatHeroHitPoint();
- public Transform hpTransform;
- public void Init(CombatHeroEntity combatHeroEntity, GameObjectPool gameObjectPool)
- {
- _combatHeroEntity = combatHeroEntity;
- GameObjectPool = gameObjectPool;
- SetGameObject(gameObjectPool);
- }
- public void SetGameObject(GameObjectPool gameObjectPool)
- {
- hpTransform = GameObjectPool.own.transform.Find("hp");
- if (hpTransform == null)
- {
- hpTransform = GameObjectPool.own.transform;
- }
- GameObjectPool = gameObjectPool;
- HitPointMono hitPointMonos = GameObjectPool.own.GetComponentInChildren<HitPointMono>(true);
- HitPointMono hitPointMono = hitPointMonos;
- _combatHeroHitPoints = new CombatHeroHitPoint();
- _combatHeroHitPoints.Init(_combatHeroEntity, hitPointMono);
- CombatController.currActiveCombat.CombatHeroController.AddHeroHitPoint(_combatHeroEntity.IsEnemy,
- _combatHeroHitPoints);
- }
- public void HeroDie()
- {
- CombatController.currActiveCombat.CombatHeroController.RemoveHeroHitPoint(_combatHeroEntity.IsEnemy,
- _combatHeroHitPoints);
- }
- public void SetPosition(Vector3 pos)
- {
- GameObjectPool.own.transform.position = pos;
- }
- public T GetILifetCycleHitPoint<T>(string hitPoinName, bool isStandType, bool isIgnoreHind)
- where T : ILifetCycleHitPoint
- {
- return (T)(object)_combatHeroHitPoints;
- }
- public T GetMainHotPoin<T>(bool isIgnoreHind) where T : ILifetCycleHitPoint
- {
- if (!isIgnoreHind && _combatHeroHitPoints.IsHide)
- {
- return default;
- }
- return (T)(object)_combatHeroHitPoints;
- }
- public void Dispose()
- {
- GObjectPool.Instance.Recycle(GameObjectPool);
- }
- }
|