本文整理汇总了C#中IVehicle.Move方法的典型用法代码示例。如果您正苦于以下问题:C# IVehicle.Move方法的具体用法?C# IVehicle.Move怎么用?C# IVehicle.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVehicle
的用法示例。
在下文中一共展示了IVehicle.Move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Move
public static void Move(IVehicle v)
{
Console.WriteLine("Moving a " + v.GetType().Name + " running on " + v.Fuel.fuel_amount + " liters of " + v.Fuel.GetType().Name + ".");
while (v.Move())
{
//System.Threading.Thread.Sleep(300);
v.Kilometers_Moved += 1;
v.Fuel.fuel_amount -= 5;
//Console.WriteLine(v.GetType().Name + " moved " + v.Kilometers_Moved + " km.");
//if (v.Fuel.fuel_amount > 0)
//{
// Console.WriteLine("Gas now at " + v.Fuel.fuel_amount + " liters.");
//}
}
Console.WriteLine("Finished moving " + v.GetType().Name + " " + v.Kilometers_Moved + " km.");
Console.WriteLine("Gas now at " + v.Fuel.fuel_amount + " liters.\n");
}