本文整理汇总了C#中City.Add方法的典型用法代码示例。如果您正苦于以下问题:C# City.Add方法的具体用法?C# City.Add怎么用?C# City.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类City
的用法示例。
在下文中一共展示了City.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public static void Test()
{
Player player = new Player("");
SimulationRegion region = new SimulationRegion();
City city = new City(region);
City city2 = new City(region);
IniSection sect = new IniSection("");
sect.Add("Name", "HUST");
sect.Add("Longitude", "0");
sect.Add("Latitude", "0");
sect.Add("Population", "150");
sect.Add("Size", UrbanSize.Large.ToString());
city.Parse(sect);
sect = new IniSection("");
sect.Add("Name", "Home");
sect.Add("Longitude", "1");
sect.Add("Latitude", "0");
sect.Add("Population", "1");
sect.Add("Size", UrbanSize.Small.ToString());
city2.Parse(sect);
region.Add(city);
//region.Add(city2);
//city.AddNearbyCity(city2);
//city2.AddNearbyCity(city);
OilField oilFld = new OilField(region);
sect = new IniSection("");
sect.Add("Amount", "100000");
sect.Add("Latitude", "1");
sect.Add("Longitude", "0");
oilFld.Parse(sect);
region.Add(oilFld);
CityPluginType plgType = new CityPluginType();
sect = new IniSection("");
sect.Add("Cost", "100");
sect.Add("HRCSpeed", "100");
sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
plgType.Parse(sect);
CityPlugin plg = new CityPlugin(plgType, CityPluginTypeId.OilRefinary);
city.Add(plg);
plgType = new CityPluginType();
sect = new IniSection("");
sect.Add("Cost", "100");
sect.Add("FoodConvRate", "0.50");
sect.Add("FoodCostSpeed", "100");
sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
plgType.Parse(sect);
plg = new CityPlugin(plgType, CityPluginTypeId.BiofuelFactory);
city.Add(plg);
//OilField oil = new OilField(region);
//Forest forest = new Forest(region);
float c = 0;
while (true)
{
Console.Clear();
Console.WriteLine("Energy Status:");
Console.Write(" Current Food Storage ");
Console.WriteLine(region.EnergyStatus.CurrentFood);
Console.Write(" Current HR Storage ");
Console.WriteLine(region.EnergyStatus.CurrentHR);
Console.Write(" Current LR Storage ");
Console.WriteLine(region.EnergyStatus.CurrentLR);
Console.Write(" Current Natural HR ");
Console.WriteLine(region.EnergyStatus.RemainingHR);
Console.Write(" Current Natural LR ");
Console.WriteLine(region.EnergyStatus.RemainingLR);
Console.WriteLine("City :" + city.Name);
Console.WriteLine("City Status:");
Console.Write(" Development ");
Console.WriteLine(city.Development);
Console.Write(" Population ");
Console.WriteLine(city.Population);
Console.Write(" Disease ");
Console.WriteLine(city.Disease);
Console.Write(" Size ");
Console.WriteLine(city.Size);
//.........这里部分代码省略.........