Ejemplo n.º 1
0
 private void PopulateFishFarmDropDown(BuildingInfo extractorInfo, BuildingInfo fishFarmInfo)
 {
     _fishFarmDropDown.ClearItems();
     if (extractorInfo == null || fishFarmInfo == null)
     {
         return;
     }
     _fishFarmDropDown.AddItems(BuildingExtension.GetFishFarms(extractorInfo, fishFarmInfo), IDToName);
 }
Ejemplo n.º 2
0
        public static ushort GetClosestFishFarm(ushort extractorID, ushort fishFarmID, Vector3 position)
        {
            ushort result           = 0;
            var    previousDistance = float.MaxValue;
            var    instance         = Singleton <BuildingManager> .instance;
            var    extractorInfo    = Singleton <BuildingManager> .instance.m_buildings.m_buffer[extractorID].Info;
            var    fishFarmInfo     = Singleton <BuildingManager> .instance.m_buildings.m_buffer[fishFarmID].Info;
            var    fishFarmsIds     = BuildingExtension.GetFishFarms(extractorInfo, fishFarmInfo);

            foreach (var fishFarmId in fishFarmsIds)
            {
                var distance = Vector3.Distance(position, instance.m_buildings.m_buffer[fishFarmId].m_position);
                if (!(distance < (double)previousDistance))
                {
                    continue;
                }
                result           = fishFarmId;
                previousDistance = distance;
            }
            return(result);
        }