public void JumpToScene(bool check, uint id, uint line = 0, Task relateTask = null) { // 在新手村第一次跳场景的时候,去找第一个传送点 if (check == true && IsFirstNavigatingJumpToScene == true && SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON")) { Dictionary <int, Neptune.BaseGenericNode> colliders = Neptune.DataManager.Instance.Data.GetData <Neptune.Collider>().Data; if (colliders != null) { foreach (Neptune.BaseGenericNode collider in colliders.Values) { if (collider.Id == 1) { if (InstanceHelper.CanWalkTo(collider.Position) == true) { LocalPlayerWalkToDestination(collider.Position, relateTask); return; } break; } } } } SceneHelp.JumpToScene(id, line); }
/// <summary> /// 找最近的可以自动采集的采集物 /// </summary> /// <param name="runningProperty"></param> /// <returns></returns> public static CollectionObject GetNearstAutoCollectableCollectionObject(AIRunningProperty runningProperty) { if (runningProperty == null) { return(null); } float shortest = float.MaxValue; Vector3 selfActorPos = runningProperty.SelfActorPos; CollectionObject retCollectionObject = null; Dictionary <int, CollectionObject> collectionObjects = xc.Dungeon.CollectionObjectManager.Instance.CollectionObjects; foreach (CollectionObject collectionObject in collectionObjects.Values) { if (collectionObject == null || collectionObject.BindGameObject == null || collectionObject.BindGameObject.transform == null) { continue; } CollectionObjectBehaviour collectionObjectBehaviour = collectionObject.BindGameObject.GetComponent <CollectionObjectBehaviour>(); if (collectionObjectBehaviour == null) { continue; } // 婚宴食物是否能采集 if (collectionObjectBehaviour.Class == "wedding_foods" && MarryManager.Instance.WeddingFoodsCanBeCollected == false) { continue; } // 婚宴宝箱是否能采集 if (collectionObjectBehaviour.Class == "wedding_bos" && MarryManager.Instance.WeddingBoxCanBeCollected == false) { continue; } Vector3 pos = collectionObject.BindGameObject.transform.position; if (!TargetPositionHeightIsAbnormal(pos)) { continue; } if (!InstanceHelper.CanWalkTo(pos)) { continue; } float distanceSquare = AIHelper.DistanceSquare(selfActorPos, pos); if (distanceSquare < shortest) { shortest = distanceSquare; retCollectionObject = collectionObject; } } return(retCollectionObject); }
static int _m_CanWalkTo_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { { UnityEngine.Vector3 dst; translator.Get(L, 1, out dst); bool __cl_gen_ret = InstanceHelper.CanWalkTo(dst); LuaAPI.lua_pushboolean(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
/// <summary> /// 飞鞋 /// </summary> public static bool TravelBootsJump(Vector3 pos, uint instanceId = 0, bool isFree = false, uint line = 1, bool isAutoFighting = false) { if (instanceId == 0) { instanceId = SceneHelp.Instance.CurSceneID; } if (PKModeManagerEx.Instance.TryToOtherDungeonScene() == false) { return(false); } DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId); if (instanceInfo == null) { GameDebug.LogError("Travel boots ump to scene " + instanceId + " error, can not find instance info!!!"); return(false); } // 本地玩家处于护送状态不能用飞鞋 if (CheckLocalPlayerEscortTaskState() == false) { return(false); } // 检查道具 if (isFree == false) { if (VipHelper.GetIsFlyFree() == false) { uint need_goods = GameConstHelper.GetUint("GAME_ITEM_TRAVEL_BOOTS"); if (need_goods > 0) { var num = ItemManager.Instance.GetGoodsNumForBagByTypeId(need_goods); if (num <= 0) { UINotice.Instance.ShowMessage(DBConstText.GetText("ITME_NUM_NOTENOUGH")); return(false); } } } } bool isInstance = false; if (instanceInfo.mWarType == GameConst.WAR_TYPE_DUNGEON) { isInstance = true; } // 检查是否达到等级 uint needLv = InstanceHelper.GetInstanceNeedRoleLevel(instanceId); if (LocalPlayerManager.Instance.LocalActorAttribute.Level < needLv) { // 巅峰等级 uint peakLv = 0; bool isPeak = TransferHelper.IsPeak(needLv, out peakLv); string levelStr = ""; if (isPeak) { levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0} } else { levelStr = peakLv.ToString(); // {0} } if (isInstance == true) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr)); } else { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr)); } return(false); } // 检查是否通关某主线任务 uint needTaskId = instanceInfo.mNeedTaskId; if (needTaskId > 0) { if (TaskHelper.MainTaskIsPassed(needTaskId) == false) { TaskDefine needTaskDefine = TaskDefine.MakeDefine(needTaskId); if (needTaskDefine != null) { // 巅峰等级 uint peakLv = 0; bool isPeak = TransferHelper.IsPeak((uint)needTaskDefine.RequestLevelMin, out peakLv); string levelStr = ""; if (isPeak) { levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0} } else { levelStr = peakLv.ToString(); // {0} } if (isInstance == true) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName)); } else { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName)); } } return(false); } } // 判断是否可到达 if (instanceId == SceneHelp.Instance.CurSceneID) { if (InstanceHelper.CanWalkTo(pos) == false) { UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH")); return(false); } } // 跳往不同的场景需要加个转圈,防止同时多次跳转 if (instanceId != SceneHelp.Instance.CurSceneID) { ui.ugui.UIManager.GetInstance().ShowWaitScreen(true); } C2STravelBootsJump data = new C2STravelBootsJump(); data.dungeon_id = instanceId; data.line = line; PkgNwarPos pkgNwarPos = new PkgNwarPos(); pkgNwarPos.px = (int)(pos.x / GlobalConst.UnitScale); pkgNwarPos.py = (int)(pos.z / GlobalConst.UnitScale); data.pos = pkgNwarPos; if (isFree == true) { data.is_free = 1; } else { data.is_free = 0; } NetClient.BaseClient.SendData <C2STravelBootsJump>(NetMsg.MSG_TRAVEL_BOOTS_JUMP, data); SceneHelp.Instance.IsAutoFightingAfterSwitchInstance = isAutoFighting; InstanceManager.Instance.IsAutoFighting = false; return(true); }