標本複数のデバイスを処理し、xおよびyは検体がローバーxおよびy に等しい場合、ドリルが、それだけで、それが操作されるたびに、試料をextraxtデバイス抽出さローバーそして、私は私がこれはローバーが可能なワンローバーオブジェクトを作っている私の主な機能である</p> <p>を考え出したことができない、単純な問題を抱えていた中で、ローバーの簡単なゲームを作っていますC#
Rover rov = new Rover();
string input;
//Device d = new Device();
//Specimen spec = new Specimen();
Console.WriteLine("Welcome to Planetary Rover");
Console.WriteLine("Enter y to start the game or n to exit");
string selection = Console.ReadLine();
if (selection == "y")
{
Console.WriteLine("Enter the rover Default Location X: ");
rov.X =
do
{
Console.WriteLine("Write the device nname to operate ");
input = Console.ReadLine();
rov.Handle(input);
//d.Operate();
} while (input != "end");
}
if (selection == "n")
{
Console.Clear();
}
else
{
Console.WriteLine("Wrong Input!");
}
標本を抽出する一つの装置があります私はこれらのことをしましたが、私の訓練クラスには上記のことをしている操作機能がありますが、訓練が行われるたびに問題が発生します
public override void Operate(string ids)
{
Rover rov = new Rover();
if (specim.X == rov.X && specim.Y == rov.Y)
{
_wearfactor += 5;
Console.WriteLine("specimen extracted and wearfaction of drill is incresed by 5%");
Console.WriteLine(_wearfactor);
_spec. = 0;
}
if(specim.X != rov.X && specim.Y != rov.Y)
{
_wearfactor += 10;
Console.WriteLine("wear factor increased by 10%");
Console.WriteLine(_wearfactor);
}
if (_wearfactor == 100)
{
Console.WriteLine("Drill Destroyed");
Console.WriteLine("syart your program again");
Console.WriteLine("You can not drill specimen now");
this.Name = "";
}
}