/// 搜索掉落物的目标(超出distance距离以外的最近的道具目标); public Pick SearchPickTarget(ObjectBase startObj, float distance) { Pick nearestObj = null; float minDis = float.MaxValue; PoolSlot slot = mObjPool.UsedList(); while (slot != null) { Pick unit = slot.Content as Pick; if (unit == null || unit == startObj || (unit.GetCurPickTableItem().resID != ZombiesStageModule.PickId && unit.GetCurPickTableItem().resID != 26)) { slot = slot.NextSlot; continue; } float dis = Vector3.Distance(unit.GetPosition(), startObj.GetPosition()); //大于最小距离 if (dis >= distance) { if (dis < minDis) { minDis = dis; nearestObj = unit; } } slot = slot.NextSlot; } return(nearestObj); }
public override void OnPick(ObjectBase pick, ObjectBase picker) { base.OnPick(pick, picker); if (pick == null || picker == null) { return; } Pick obj = pick as Pick; if (obj == null) { return; } PickTableItem pti = obj.GetCurPickTableItem(); if (pti == null) { return; } if (pick.GetAlias() == "pick_buff") { ModuleManager.Instance.FindModule <MonsterFloodModule>().TempMoney -= 50; GameDebug.Log("拾取pick_buff:" + pti.resID); RemoveObjsByAlias <Pick>(MonsterFloodModule.Pick_Buff); BattleUIEvent bu4 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_TEMPMONEY); bu4.msg = pick.GetPosition(); EventSystem.Instance.PushEvent(bu4); } }
public override void OnPick(ObjectBase pick, ObjectBase picker) { base.OnPick (pick, picker); if (pick == null || picker == null) return; Pick obj = pick as Pick; if (obj == null) return; PickTableItem pti = obj.GetCurPickTableItem(); if (pti == null) return; if (!ObjectType.IsPlayer(picker.Type)) return; if (pti.resID == mGoldId1 || pti.resID == mGoldId2 || pti.resID == mGoldId3) { if (mCurPickCount >= mMaxPickCount) return; mCurPickCount++; MaoStageUpdateGoldEvent eUI = new MaoStageUpdateGoldEvent(); eUI.CurrentGold = mCurPickCount; eUI.TotalGold = mMaxPickCount; eUI.PickPos = obj.GetPosition(); EventSystem.Instance.PushEvent(eUI); if (mCurPickCount >= mMaxPickCount) { EventSystem.Instance.PushEvent(new MaoStageSucceedEvent()); } } else { FindPickEvent e = new FindPickEvent(); e.OwnerId = (int)picker.InstanceID; e.PickResId = pti.resID; e.Position = obj.GetPosition(); EventSystem.Instance.PushEvent(e); } }
public override void OnPick(ObjectBase pick, ObjectBase picker) { base.OnPick(pick, picker); if (pick == null || picker == null) { return; } Pick obj = pick as Pick; if (obj == null) { return; } PickTableItem pti = obj.GetCurPickTableItem(); if (pti == null) { return; } //switch(pti.resID) //{ // case 5: //齿轮碎片; // BattleUIEvent bue1 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_GEAR); // bue1.msg = pick.GetPosition(); // EventSystem.Instance.PushEvent(bue1); // break; // case 3: //捡到金币; // BattleUIEvent bue2 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_GOLD); // bue2.msg = pick.GetPosition(); // EventSystem.Instance.PushEvent(bue2); // break; //} int pickId = (int)ConfigManager.GetVal <int>(ConfigItemKey.ZOMBIE_PICK_ID); //Debug.LogError(pti.resID); if (pti.resID == pickId) { BattleUIEvent bue1 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_ZOMBIE_PICK1); //bue1.msg = pick.GetPosition(); EventSystem.Instance.PushEvent(bue1); } }