bool theNearestToObjIsCarNotMoney(RoleInGame player, Car car, interfaceOfHM.GetFPIndex getF, out OssModel.FastonPosition fp) { fp = null; if (car.state == CarState.waitAtBaseStation) { double distanceToDiamond; var from = Program.dt.GetFpByIndex(getF.GetFPIndex()); { var fpTo = Program.dt.GetFpByIndex(player.StartFPIndex);; //this.GetPromotePositionTo(pType); distanceToDiamond = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); } foreach (var item in this._collectPosition) { // var from = Program.dt.GetFpByIndex(player.StartFPIndex); var fpTo = Program.dt.GetFpByIndex(item.Value); var distanceToMoney = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); if (distanceToMoney <= distanceToDiamond) { distanceToDiamond = distanceToMoney; fp = fpTo; // return false; } } return(fp == null); } else if (car.state == CarState.waitOnRoad) { var from = Program.dt.GetFpByIndex(getF.GetFPIndex()); double distanceToDiamond; { var fpTo = Program.dt.GetFpByIndex(car.targetFpIndex); distanceToDiamond = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); } foreach (var item in this._collectPosition) { var fpTo = Program.dt.GetFpByIndex(item.Value); var distanceToMoney = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); if (distanceToMoney <= distanceToDiamond) { distanceToDiamond = distanceToMoney; fp = fpTo; } } return(fp == null); } else { throw new Exception("非法调用"); } }
int getAttackerClosestPositionRankNum(RoleInGame player, Car car, interfaceOfHM.GetFPIndex getF) { int rank = 0; if (car.state == CarState.waitAtBaseStation) { double distanceToDiamond; var from = Program.dt.GetFpByIndex(getF.GetFPIndex()); { var fpTo = Program.dt.GetFpByIndex(player.StartFPIndex);; //this.GetPromotePositionTo(pType); distanceToDiamond = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); } foreach (var item in this._collectPosition) { // var from = Program.dt.GetFpByIndex(player.StartFPIndex); var fpTo = Program.dt.GetFpByIndex(item.Value); var distanceToMoney = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); if (distanceToMoney <= distanceToDiamond) { rank++; } } return(rank); } else if (car.state == CarState.waitOnRoad) { var from = Program.dt.GetFpByIndex(getF.GetFPIndex()); double distanceToDiamond; { var fpTo = Program.dt.GetFpByIndex(car.targetFpIndex); distanceToDiamond = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); } foreach (var item in this._collectPosition) { var fpTo = Program.dt.GetFpByIndex(item.Value); var distanceToMoney = CommonClass.Geography.getLengthOfTwoPoint.GetDistance(from.Latitde, from.Longitude, fpTo.Latitde, fpTo.Longitude); if (distanceToMoney <= distanceToDiamond) { rank++; } } return(rank); } else { throw new Exception("非法调用"); } }