AreaCrossInfo GetNearestAreaCross() { double nearestDis = 1000.0; AreaCrossInfo nearest = null; foreach (var item in areaCrossList) { double dis = CalcDis(player.Pos, item.Pos); if (dis < nearestDis) { nearest = item; nearestDis = dis; } } return(nearest); }
const sbyte PollutantGateType = 9; //地图连接门 void UpdateGameInfo() { round = Program.client.GetRoundList(); monsterList.Clear(); boxList.Clear(); doorList.Clear(); trophyList.Clear(); trophyIDList.Clear(); NearbyPollutantGatePos = null; foreach (var item in round) { //掉落物品 //门 //桶箱 //传送门 switch (item.Type) { case MonsterType: SMonsterInfo monster = new SMonsterInfo(item); monsterList.Add(monster); break; case ChestType: SBox box = new SBox(item); boxList.Add(box); break; case DoorType: SDoor door = new SDoor(item); doorList.Add(door); break; case TrophyType: TrophyBaseInfo trophy = new TrophyBaseInfo(); trophy.ObjPtr = item.ObjPtr; trophy.X = (short)item.X; trophy.Y = (short)item.Y; trophyIDList.Add(trophy); break; case AreaCrossType: AreaCrossInfo areaCross = new AreaCrossInfo(item); areaCrossList.Add(areaCross); break; case WaypointType: break; case PollutantGateType: NearbyPollutantGatePos = new GPoint(); NearbyPollutantGatePos.x = (ushort)item.X; NearbyPollutantGatePos.y = (ushort)item.Y; break; } } CurMapID = Program.client.GetCurrentMapID(); trophyList = Program.client.GetTrophyList(trophyIDList); PlayerInfo tempPlayer = Program.client.GetPlayerInfo(); player.Level = tempPlayer.Level; player.HP = tempPlayer.HP; player.MaxHP = tempPlayer.MaxHP; player.MP = tempPlayer.MP; player.Shield = tempPlayer.Shield; player.MaxMP = tempPlayer.MaxMP; player.Pos.x = (ushort)tempPlayer.X; player.Pos.y = (ushort)tempPlayer.Y; }