From d59a1aaa52dffe6aec8a1f2b69e645b570e106cb Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期四, 18 四月 2019 15:03:29 +0800
Subject: [PATCH] 382 增加主角被攻击回调
---
Fight/GameActor/GAMgr.cs | 1
Fight/Actor/Status/Status_Base.cs | 62 ++++++++++++++++---------------
Fight/Actor/Skill/FlyObject/FlyObjectManager.cs | 1
Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0614_tagUseSkillPos.cs | 7 ++-
Fight/GameActor/GA_Hero.cs | 19 +++++++++
5 files changed, 56 insertions(+), 34 deletions(-)
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0614_tagUseSkillPos.cs b/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0614_tagUseSkillPos.cs
index 1b149b6..918e8ec 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0614_tagUseSkillPos.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/H06_PlayerVsNPC/DTC0614_tagUseSkillPos.cs
@@ -201,13 +201,14 @@
if (_cTarget.ServerInstID == PlayerDatas.Instance.PlayerId)
{
- if (GAMgr.Instance.otherPlayerAtkHeroDict.ContainsKey(_cTarget.ServerInstID))
+ if (GAMgr.Instance.otherPlayerAtkHeroDict.ContainsKey(_attacker.ServerInstID))
{
- GAMgr.Instance.otherPlayerAtkHeroDict[_cTarget.ServerInstID] = Time.realtimeSinceStartup;
+ GAMgr.Instance.otherPlayerAtkHeroDict[_attacker.ServerInstID] = Time.realtimeSinceStartup;
}
else
{
- GAMgr.Instance.otherPlayerAtkHeroDict.Add(_cTarget.ServerInstID, Time.realtimeSinceStartup);
+ GAMgr.Instance.otherPlayerAtkHeroDict.Add(_attacker.ServerInstID, Time.realtimeSinceStartup);
+ GA_Hero.CallOnStartBeAttacked(_attacker.ServerInstID);
}
if (!_attacker.ShowOrHide)
diff --git a/Fight/Actor/Skill/FlyObject/FlyObjectManager.cs b/Fight/Actor/Skill/FlyObject/FlyObjectManager.cs
index 7365fa7..e27d14a 100644
--- a/Fight/Actor/Skill/FlyObject/FlyObjectManager.cs
+++ b/Fight/Actor/Skill/FlyObject/FlyObjectManager.cs
@@ -48,7 +48,6 @@
}
else if (_so.type == SoFlyObject.E_FlyObjectType.Transmit)
{
-
if (_pool.inactivedCount == 0)
{
_pool.Add(new FoTransmit());
diff --git a/Fight/Actor/Status/Status_Base.cs b/Fight/Actor/Status/Status_Base.cs
index 826dc2e..dd382e5 100644
--- a/Fight/Actor/Status/Status_Base.cs
+++ b/Fight/Actor/Status/Status_Base.cs
@@ -78,43 +78,45 @@
if (data.BuffType == (int)E_BuffType.bfActionBuff)
{
GActorPlayerBase _player = _target as GActorPlayerBase;
-
- if (!CanMove())
+ if (_player != null)
{
- if (_target is GActorPlayerBase)
+ if (!CanMove())
{
- _player = _target as GActorPlayerBase;
- _player.OnHorse(0);
- _player.StopRush();
+ if (_target is GActorPlayerBase)
+ {
+ _player = _target as GActorPlayerBase;
+ _player.OnHorse(0);
+ _player.StopRush();
+ }
+
+ if (_target.State == E_ActorState.AutoRun)
+ {
+ _target.StopPathFind();
+ }
+
+ if (_target is GA_Player)
+ {
+ GA_Player _otherPlayer = _target as GA_Player;
+ _otherPlayer.StopMoveToPosition();
+ }
+ _player.IdleImmediate();
}
- if (_target.State == E_ActorState.AutoRun)
+ // 璋冪敤鍔ㄤ綔
+ if (m_SkillConfig.CtrlActionID != 0)
{
- _target.StopPathFind();
- }
+ if (_player != null)
+ {
+ _player = _target as GActorPlayerBase;
+ _player.OnHorse(0);
+ }
- if (_target is GA_Player)
- {
- GA_Player _otherPlayer = _target as GA_Player;
- _otherPlayer.StopMoveToPosition();
- }
- _player.IdleImmediate();
- }
+ _target.NextAction = m_SkillConfig.CtrlActionID;
- // 璋冪敤鍔ㄤ綔
- if (m_SkillConfig.CtrlActionID != 0)
- {
- if (_player != null)
- {
- _player = _target as GActorPlayerBase;
- _player.OnHorse(0);
- }
-
- _target.NextAction = m_SkillConfig.CtrlActionID;
-
- if (_target.SkillMgr.CurCastSkill != null)
- {
- _target.SkillMgr.CurCastSkill.SkillCompelete = true;
+ if (_target.SkillMgr.CurCastSkill != null)
+ {
+ _target.SkillMgr.CurCastSkill.SkillCompelete = true;
+ }
}
}
}
diff --git a/Fight/GameActor/GAMgr.cs b/Fight/GameActor/GAMgr.cs
index bc408e4..dde66e8 100644
--- a/Fight/GameActor/GAMgr.cs
+++ b/Fight/GameActor/GAMgr.cs
@@ -1161,6 +1161,7 @@
{
if (otherPlayerAtkHeroDict.ContainsKey(_removeIdList[i]))
{
+ GA_Hero.CallOnStopBeAttacked(_removeIdList[i]);
otherPlayerAtkHeroDict.Remove(_removeIdList[i]);
}
}
diff --git a/Fight/GameActor/GA_Hero.cs b/Fight/GameActor/GA_Hero.cs
index 2b29ea3..ee78ebf 100644
--- a/Fight/GameActor/GA_Hero.cs
+++ b/Fight/GameActor/GA_Hero.cs
@@ -22,6 +22,25 @@
// }
//}
+ public static event UnityAction<uint> OnStartBeAttacked;
+ public static event UnityAction<uint> OnStopBeAttacked;
+
+ public static void CallOnStartBeAttacked(uint sid)
+ {
+ if (OnStartBeAttacked != null)
+ {
+ OnStartBeAttacked(sid);
+ }
+ }
+
+ public static void CallOnStopBeAttacked(uint sid)
+ {
+ if (OnStopBeAttacked != null)
+ {
+ OnStopBeAttacked(sid);
+ }
+ }
+
public static event UnityAction<float> OnStateEnter;
public static event UnityAction OnStateEnd;
--
Gitblit v1.8.0