6662 子 【开发】【2.0】战斗需要木桩 / 【前端】【2.0】战斗需要木桩
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 0C 召唤私有专属木桩怪 #tagCMSummonPriWoodPile |
| | | |
| | | public class CB40C_tagCMSummonPriWoodPile : GameNetPackBasic |
| | | { |
| | | public uint NPCID; |
| | | public byte Count; //默认1个,最多5个 |
| | | |
| | | public CB40C_tagCMSummonPriWoodPile() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB40C; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(NPCID, NetDataType.DWORD); |
| | | WriteBytes(Count, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 28a5da463ffd3984088422a1da4229b3 |
| | | timeCreated: 1557989070 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | case E_NpcType.Fight:
|
| | | case E_NpcType.FMBoss:
|
| | | case E_NpcType.MonsterTime:
|
| | | case E_NpcType.PersonalEnemy:
|
| | |
|
| | | if (_npcConfig.Country == 1)
|
| | | {
|
| | |
| | | GAMgr.Instance.RequestPlayer<GA_NpcFightSgzcZZ>(vNetData.ObjID, E_ActorGroup.Player, vNetData);
|
| | |
|
| | | break;
|
| | | case E_NpcType.PersonalEnemy:
|
| | |
|
| | | break;
|
| | | }
|
| | |
|
| | | if (StageLoad.Instance.isLoadingScene)
|
| | |
| | | |
| | | public class DTC0408_tagPlayerSummonNPCAppear : DtcBasic |
| | | { |
| | | |
| | | public override void Done(GameNetPackBasic vNetPack) |
| | | { |
| | | base.Done(vNetPack); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (_npcConfig.NPCType == (int)E_NpcType.PersonalEnemy) |
| | | { |
| | | PersonalEnemy.Cache(vNetData); |
| | | return; |
| | | } |
| | | |
| | | if (_npcConfig.NPCType == (int)E_NpcType.Collect) |
| | | { |
| | | _actor = GAMgr.Instance.RequestNpcNoFight<GA_NpcSummonFunc>(vNetData.ObjID, |
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | // 判断范围内的目标是否可以接入可攻击列表中
|
| | | List<GActor> _actorList = GAMgr.Instance.GetAll();
|
| | | _actorList.Sort((GActor a1, GActor a2) =>
|
| | |
| | | continue;
|
| | | }
|
| | | #endif
|
| | | if (_actorList[i] is GA_NpcClientFightNorm
|
| | | || _actorList[i] is GA_NpcFightSgzcZZ)
|
| | |
|
| | | if (_actorList[i] is GA_NpcClientFightNorm)
|
| | | {
|
| | | if (CheckCanAttackTarget(_actorList[i] as GActorFight, skill, _soSkill, skill.targetPosition))
|
| | | {
|
| | | var _sid = _actorList[i].ServerInstID;
|
| | | if (PersonalEnemy.GetPersionEnemySID(_sid) != 0)
|
| | | {
|
| | | AddToHitTargetList(skill, _actorList[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | AddToHitClientBattleTargetList(skill, _actorList[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | else if (_actorList[i] is GA_NpcFightSgzcZZ)
|
| | | {
|
| | | if (CheckCanAttackTarget(_actorList[i] as GActorFight, skill, _soSkill, skill.targetPosition))
|
| | | {
|
| | |
| | | _serverHurtList.Clear();
|
| | |
|
| | | // Debug.LogFormat("释放了技能: {0},当前位置: {1} 目标位置: {2}", _b405.SkillID, new Vector2(_b405.PosX, _b405.PosY), new Vector2(_b405.TagPosX, _b405.TagPosY));
|
| | |
|
| | | uint _bindID = 0;
|
| | | // 创建出攻击客户端攻击对象和服务端攻击对象
|
| | | for (int i = 0; i < skill.hitTargetList.Count; ++i)
|
| | | {
|
| | |
| | | Debug.LogFormat("<color=red>找到的目标对象: C:{0} 为空....</color>", skill.hitTargetList[i]);
|
| | | continue;
|
| | | }
|
| | | _bindID = 0;
|
| | | if (_target is GA_NpcClientFightNorm)
|
| | | {
|
| | | _bindID = PersonalEnemy.GetPersionEnemySID(_target.ServerInstID);
|
| | | if (_bindID == 0)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | // 选中对象都要生成服务端对象
|
| | | CB405_tagCMSuperAtk.tagSkillPosHurtObj _hurtObj = new CB405_tagCMSuperAtk.tagSkillPosHurtObj();
|
| | | _hurtObj.ObjID = (uint)_target.ServerInstID;
|
| | | _hurtObj.ObjID = _bindID == 0 ? _target.ServerInstID : _bindID;
|
| | |
|
| | | if (_target is GA_PlayerXMZZ)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (_bindID != 0)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | // 计算此次伤害
|
| | | AttackHandler.CalculateDamage(m_Hero, _target, skill, i, ref _hurtValue, ref _attackType);
|
| | |
|
| | |
| | | |
| | | protected virtual void InitAI() |
| | | { |
| | | if (NpcConfig.AIType == 1) |
| | | if (NpcConfig.AIType == 1 |
| | | || NpcConfig.AIType == 202) |
| | | { |
| | | m_AIHandler = new AI_Npc_200(this, BornPos); |
| | | } |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class PersonalEnemy |
| | | { |
| | | public H0408_tagPlayerSummonNPCAppear data; |
| | | public uint bindClientNpcSID = 0; |
| | | |
| | | private static Dictionary<uint, PersonalEnemy> m_Map = new Dictionary<uint, PersonalEnemy>(); |
| | | public static Dictionary<uint, uint> m_BindDict = new Dictionary<uint, uint>(); |
| | | |
| | | private static List<PersonalEnemy> m_UnUsed = new List<PersonalEnemy>(); |
| | | |
| | | public static void UnInit() |
| | | { |
| | | m_Map.Clear(); |
| | | m_BindDict.Clear(); |
| | | m_UnUsed.Clear(); |
| | | } |
| | | |
| | | public static uint GetPersionEnemySID(uint sid) |
| | | { |
| | | uint _objID = 0; |
| | | if (m_BindDict.TryGetValue(sid, out _objID)) |
| | | { |
| | | return _objID; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public static PersonalEnemy Cache(H0408_tagPlayerSummonNPCAppear h0406) |
| | | { |
| | | var _pm = new PersonalEnemy(); |
| | | _pm.data = h0406; |
| | | m_Map[h0406.ObjID] = _pm; |
| | | m_UnUsed.Add(_pm); |
| | | return _pm; |
| | | } |
| | | |
| | | public static void Bind(GA_NpcClientFightNorm npc) |
| | | { |
| | | var _package = new CB40C_tagCMSummonPriWoodPile(); |
| | | _package.NPCID = (uint)npc.NpcConfig.NPCID; |
| | | _package.Count = 1; |
| | | GameNetSystem.Instance.SendInfo(_package); |
| | | |
| | | SnxxzGame.Instance.StartCoroutine(_Bind(npc)); |
| | | } |
| | | |
| | | private static IEnumerator _Bind(GA_NpcClientFightNorm npc) |
| | | { |
| | | #if UNITY_EDITOR |
| | | Debug.LogFormat("开始执行客户端召唤怪: {0}", npc.ServerInstID); |
| | | #endif |
| | | PersonalEnemy _pm = null; |
| | | while (true) |
| | | { |
| | | for (int i = 0; i < m_UnUsed.Count; ++i) |
| | | { |
| | | if (m_UnUsed[i].data.NPCID == npc.NpcConfig.NPCID) |
| | | { |
| | | _pm = m_UnUsed[i]; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (_pm != null) |
| | | { |
| | | m_UnUsed.Remove(_pm); |
| | | _pm.bindClientNpcSID = npc.ServerInstID; |
| | | m_BindDict[npc.ServerInstID] = _pm.data.ObjID; |
| | | npc.ActorInfo.LV = _pm.data.LV; |
| | | npc.RequestName(); |
| | | npc.ActorInfo.ResetHp((int)_pm.data.HP, (short)_pm.data.HPEx, (int)_pm.data.MaxHP, (short)_pm.data.MaxHPEx); |
| | | #if UNITY_EDITOR |
| | | Debug.LogFormat("找到了可绑定的专属敌人: {0}", _pm.data.ObjID); |
| | | #endif |
| | | yield break; |
| | | } |
| | | |
| | | yield return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 33f231c6df5f27048878a3b7b12e445c |
| | | timeCreated: 1557978317 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | |
|
| | | StopAllCoroutines();
|
| | | s_MapTransferDict.Clear();
|
| | |
|
| | | if (s_MapAreaDict != null)
|
| | | {
|
| | | foreach (var _list in s_MapAreaDict.Values)
|
| | |
| | | ClientDropItemUtility.Instance.ReleaseAll();
|
| | | SFXPlayUtility.Instance.Unitialize();
|
| | | FakeDungeonUtility.Instance.Reset();
|
| | | PersonalEnemy.UnInit();
|
| | | }
|
| | |
|
| | | protected override void OnUpdate()
|