|
@@ -7,6 +7,7 @@ using Fort23.Core;
|
|
|
using Fort23.UTool;
|
|
|
using GameLogic.Combat.CombatTool;
|
|
|
using GameLogic.Combat.Hero;
|
|
|
+using GameLogic.Combat.Hero.HeroGPU;
|
|
|
using UnityEngine;
|
|
|
using UnityEngine.AI;
|
|
|
using UnityEngine.Rendering;
|
|
@@ -18,6 +19,7 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
/// 死亡时的节点ID
|
|
|
/// </summary>
|
|
|
public int heroDieNodeId;
|
|
|
+
|
|
|
public bool IsEnemy { get; set; }
|
|
|
public bool isDie { get; set; }
|
|
|
public int number;
|
|
@@ -31,6 +33,12 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
|
|
|
public bool isFollowState;
|
|
|
public BetterList<CombatParticleSystemPool> heroLoopParticle = new BetterList<CombatParticleSystemPool>();
|
|
|
+ private float _lasetShowHarmTime;
|
|
|
+
|
|
|
+
|
|
|
+ private float _injuriedShowTime;
|
|
|
+ private bool _isAddinjuriedShow;
|
|
|
+ private float _addInjuiedValue = (1.0f / 0.2f) *1f;
|
|
|
|
|
|
public Vector3 dotPos
|
|
|
{
|
|
@@ -62,6 +70,8 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
modelName += "_gpu";
|
|
|
}
|
|
|
|
|
|
+ CurrCombatHeroInfo = combatHeroInfo.Copy();
|
|
|
+ MaxCombatHeroInfo = combatHeroInfo.Copy();
|
|
|
// GameTimeLineParticleFactory
|
|
|
GameObjectPool poolInterface =
|
|
|
await GObjectPool.Instance.FetchAsync<GameObjectPool>(modelName + ".prefab", null);
|
|
@@ -75,15 +85,16 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
AssetHandle assetHandle =
|
|
|
await AssetBundleLoadManager.Instance.LoadAssetAsyncTask<TextAsset>(combatHeroInfo.modelName + "_TD.txt");
|
|
|
TextAsset textAsset = assetHandle.AssetObject<TextAsset>();
|
|
|
+ combatHeroGameObject = new CombatHeroGameObject();
|
|
|
+ combatHeroGameObject.Init(this, poolInterface);
|
|
|
|
|
|
TimeLienData timeLienData = JsonManager.FromJson<TimeLienData>(textAsset.text);
|
|
|
timeLienData.DeserializeData();
|
|
|
assetHandle.Release();
|
|
|
combatHeroTimeLineControl = new CombatHeroTimeLineControl();
|
|
|
- combatHeroTimeLineControl.Init(this,timeLienData);
|
|
|
+ combatHeroTimeLineControl.Init(this, timeLienData);
|
|
|
+
|
|
|
|
|
|
- combatHeroGameObject = new CombatHeroGameObject();
|
|
|
- combatHeroGameObject.Init(this, poolInterface);
|
|
|
NavMeshAgent navMeshAgent = poolInterface.own.GetComponent<NavMeshAgent>();
|
|
|
if (combatAIBasic == null)
|
|
|
{
|
|
@@ -100,8 +111,6 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
CombatAIBasic = combatAIBasic;
|
|
|
CombatAIBasic.Init(this, navMeshAgent);
|
|
|
|
|
|
- CurrCombatHeroInfo = combatHeroInfo.Copy();
|
|
|
- MaxCombatHeroInfo = combatHeroInfo.Copy();
|
|
|
|
|
|
CombatHeroSkillControl = new CombatHeroSkillControl();
|
|
|
CombatHeroSkillControl.Init(this);
|
|
@@ -119,9 +128,13 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
|
|
|
combatHeroAnimtion.Init(this);
|
|
|
CombatAIBasic.ChangeState(CombatHeroStateType.XiuMian);
|
|
|
- CreateHeroHpEventData createHeroHpEventData = CreateHeroHpEventData.Create();
|
|
|
- createHeroHpEventData.combatHeroEntity = this;
|
|
|
- EventManager.Instance.Dispatch(CustomEventType.CreateHeroHp, createHeroHpEventData);
|
|
|
+ if (!IsEnemy)
|
|
|
+ {
|
|
|
+ CreateHeroHpEventData createHeroHpEventData = CreateHeroHpEventData.Create();
|
|
|
+ createHeroHpEventData.combatHeroEntity = this;
|
|
|
+ EventManager.Instance.Dispatch(CustomEventType.CreateHeroHp, createHeroHpEventData);
|
|
|
+ }
|
|
|
+
|
|
|
poolInterface.own.SetActive(true);
|
|
|
callBack?.Invoke(this);
|
|
|
#endif
|
|
@@ -135,6 +148,29 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
CombatHeroSkillControl.Update(t);
|
|
|
combatHeroTimeLineControl.Update(t);
|
|
|
combatHeroAnimtion.Update(t);
|
|
|
+ if (combatHeroGameObject.HeroGPUMono != null)
|
|
|
+ {
|
|
|
+ if (_injuriedShowTime > 0)
|
|
|
+ {
|
|
|
+ _injuriedShowTime -= t;
|
|
|
+ if (_isAddinjuriedShow)
|
|
|
+ {
|
|
|
+ combatHeroGameObject.HeroGPUMono.injuriedStrength += t * (_addInjuiedValue);
|
|
|
+ if (combatHeroGameObject.HeroGPUMono.injuriedStrength >= 1f)
|
|
|
+ {
|
|
|
+ _isAddinjuriedShow = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ combatHeroGameObject.HeroGPUMono.injuriedStrength -= t * (_addInjuiedValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ combatHeroGameObject.HeroGPUMono.injuriedStrength = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public T This<T>()
|
|
@@ -167,6 +203,7 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
{
|
|
|
return CombatHeroSkillControl.NormalAttSpeedScale;
|
|
|
}
|
|
|
+
|
|
|
public void HeroResurrection()
|
|
|
{
|
|
|
isDie = false;
|
|
@@ -175,6 +212,7 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
heroHpUpdateEventData.combatHeroEntity = this;
|
|
|
CombatEventManager.Instance.Dispatch(CombatEventType.HeroHpUpdate, heroHpUpdateEventData);
|
|
|
}
|
|
|
+
|
|
|
public void HeroDie(HarmReturnInfo harmReturnInfo)
|
|
|
{
|
|
|
heroDieNodeId = CombatController.currActiveCombat.CombatTypeBasic.allWinNodeCount;
|
|
@@ -191,9 +229,13 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
public void HeroHurt(HarmReturnInfo harmReturnInfo)
|
|
|
{
|
|
|
CurrCombatHeroInfo.hp -= harmReturnInfo.att;
|
|
|
- HarmUpdateEventData harmUpdateEventData = HarmUpdateEventData.Create();
|
|
|
- harmUpdateEventData.HarmReturnInfo = harmReturnInfo;
|
|
|
- CombatEventManager.Instance.Dispatch(CombatEventType.HarmUpdate, harmUpdateEventData);
|
|
|
+ UpdateHarmText(harmReturnInfo);
|
|
|
+ if (combatHeroGameObject.HeroGPUMono != null)
|
|
|
+ {
|
|
|
+ _injuriedShowTime = 0.4f;
|
|
|
+ combatHeroGameObject.HeroGPUMono.injuriedStrength = 0;
|
|
|
+ _isAddinjuriedShow = true;
|
|
|
+ }
|
|
|
|
|
|
HeroHpUpdateEventData heroHpUpdateEventData = HeroHpUpdateEventData.Create();
|
|
|
heroHpUpdateEventData.combatHeroEntity = this;
|
|
@@ -204,6 +246,20 @@ public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle, ITimeLineAni
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void UpdateHarmText(HarmReturnInfo harmReturnInfo)
|
|
|
+ {
|
|
|
+ float currTime = Time.time;
|
|
|
+ if (currTime - _lasetShowHarmTime < 0.1f)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ _lasetShowHarmTime = currTime;
|
|
|
+ HarmUpdateEventData harmUpdateEventData = HarmUpdateEventData.Create();
|
|
|
+ harmUpdateEventData.HarmReturnInfo = harmReturnInfo;
|
|
|
+ CombatEventManager.Instance.Dispatch(CombatEventType.HarmUpdate, harmUpdateEventData);
|
|
|
+ }
|
|
|
+
|
|
|
public void Recover(HarmReturnInfo harmReturnInfo)
|
|
|
{
|
|
|
CurrCombatHeroInfo.hp += harmReturnInfo.att;
|