using System; using System.Collections; using System.Collections.Generic; using Core.Triiger; using Fort23.UTool; using GameLogic.Combat.CombatTool; using GameLogic.Combat.Hero; using GameLogic.Combat.Hero.HeroGPU; using GameTimeLine.CustomizeTimeLogic; using UnityEngine; using Utility; using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface; public class CombatHeroGameObject : IDisposable { public GameObjectPool GameObjectPool; public HeroGPUMono HeroGPUMono; public Transform transform { get { if (GameObjectPool == null) { return null; } return GameObjectPool.own.transform; } } public Vector3 position { get { if (GameObjectPool == null) { return Vector3.zero; } return GameObjectPool.own.transform.position; } } public Quaternion rotation { get { if (GameObjectPool == null) { return Quaternion.identity; } return GameObjectPool.own.transform.rotation; } set { GameObjectPool.own.transform.rotation = value; } } private ShowBaiscEntity _combatHeroEntity; private CombatHeroHitPoint _combatHeroHitPoints = new CombatHeroHitPoint(); public Transform hpTransform; public void Init(ShowBaiscEntity combatHeroEntity, GameObjectPool gameObjectPool) { _combatHeroEntity = combatHeroEntity; GameObjectPool = gameObjectPool; SetGameObject(gameObjectPool); } public void SetGameObject(GameObjectPool gameObjectPool) { if (gameObjectPool == null) { _combatHeroHitPoints = new CombatHeroHitPoint(); // _combatHeroHitPoints.Init(_combatHeroEntity, null); return; } hpTransform = GameObjectPool.own.transform.Find("hp"); if (hpTransform == null) { hpTransform = GameObjectPool.own.transform; } HeroGPUMono = GameObjectPool.own.GetComponent(); if (HeroGPUMono != null) { CombatHeroEntity combatHeroEntity= _combatHeroEntity as CombatHeroEntity; if (combatHeroEntity != null) { if (combatHeroEntity.CurrCombatHeroInfo.heroType == 3) { HeroGPUMono.edgeStength = 3; HeroGPUMono.edgecolor = new Color(0.8f, 0.44f, 0.02f); } else if (combatHeroEntity.CurrCombatHeroInfo.heroType == 4) { HeroGPUMono.edgeStength = 3; HeroGPUMono.edgecolor = new Color(0.8f, 0.16f, 0f); } else { HeroGPUMono.edgeStength = 0; } } } GameObjectPool = gameObjectPool; HitPointMono hitPointMonos = GameObjectPool.own.GetComponentInChildren(true); HitPointMono hitPointMono = hitPointMonos; _combatHeroHitPoints = new CombatHeroHitPoint(); _combatHeroHitPoints.Init(_combatHeroEntity, hitPointMono); CombatController.currActiveCombat.CombatHeroController.AddHeroHitPoint(_combatHeroEntity.IsEnemy, _combatHeroHitPoints); } public void Update(float t) { _combatHeroHitPoints.Update(t); } public void HeroDie() { CombatController.currActiveCombat.CombatHeroController.RemoveHeroHitPoint(_combatHeroEntity.IsEnemy, _combatHeroHitPoints); } public void SetPosition(Vector3 pos) { GameObjectPool.own.transform.position = pos; } public void SetScale(Vector3 size) { GameObjectPool.own.transform.localScale = size; } public T GetILifetCycleHitPoint(string hitPoinName, bool isStandType, bool isIgnoreHind) where T : ILifetCycleHitPoint { return (T)(object)_combatHeroHitPoints; } public T GetMainHotPoin(bool isIgnoreHind) where T : ILifetCycleHitPoint { if (!isIgnoreHind && _combatHeroHitPoints.IsHide) { return default; } return (T)(object)_combatHeroHitPoints; } public void Dispose() { GObjectPool.Instance.Recycle(GameObjectPool); } }