/// <summary> /// 锁定目标 /// </summary> /// <param name="ItemList"></param> private void OnLockEnemySoldier() { GameObject mGameObjectLock = mBtnArray[(int)ShortCutBarBtn.BTN_CHANGELOCK].gameObject; List <Ientity> itemList = new List <Ientity>(); if (GamePlayGuideModel.Instance.IsGuideTrigger(ButtonTriggerType.mTypeClick, mGameObjectLock)) { itemList = GameMethod.GetMonsterEnemyItemListByRadius(PlayerManager.Instance.LocalPlayer, GameConstDefine.PlayerLockTargetDis); } else { itemList = GameMethod.GetSoldierEnemyItemListByRadius(PlayerManager.Instance.LocalPlayer, GameConstDefine.PlayerLockTargetDis); } if (itemList == null || itemList.Count == 0) { return; } if (mSyncLockSelIndex >= itemList.Count) { mSyncLockSelIndex = 0; } PlayerManager.Instance.LocalPlayer.SetSyncLockTarget(itemList[mSyncLockSelIndex]); mSyncLockSelIndex++; }
/// <summary> /// 锁定目标 /// </summary> /// <param name="ItemList"></param> private void OnLockEnemySoldier() { GameObject mGameObjectLock = mBtnArray[(int)ShortCutBarBtn.BTN_CHANGELOCK].gameObject; //锁定按钮 List <IEntity> itemList = new List <IEntity>(); //目标锁定集合 if (GamePlayGuideModel.Instance.IsGuideTrigger(ButtonTriggerType.mTypeClick, mGameObjectLock)) { //根据距离排序所有敌对阵营的野怪集合 itemList = GameMethod.GetMonsterEnemyItemListByRadius(PlayerManager.Instance.LocalPlayer, GameConstDefine.PlayerLockTargetDis); } else { //根据距离排序所有敌对阵营的小兵集合 itemList = GameMethod.GetSoldierEnemyItemListByRadius(PlayerManager.Instance.LocalPlayer, GameConstDefine.PlayerLockTargetDis); } if (itemList == null || itemList.Count == 0) { return; } if (mSyncLockSelIndex >= itemList.Count)//当索引大于集合长度时,索引从0再次开始 { mSyncLockSelIndex = 0; } PlayerManager.Instance.LocalPlayer.SetSyncLockTarget(itemList[mSyncLockSelIndex]); //设置索引对象 mSyncLockSelIndex++; //当再次点击时,目标自动寻找集合中的下一个 }