123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- 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<HeroGPUMono>();
- 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<HitPointMono>(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<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);
- }
- }
|