public void boatMove() { if (!myBoat.ifEmpty() && myBoat.getRunningState() != "running") { string toSize; string[] passengers = myBoat.getPassengerName(); if (myBoat.size == "left") { toSize = "right"; } else { toSize = "left"; } for (int loop = 0; loop < 2; loop++) { for (int loop1 = 0; loop1 < numOfPeople; loop1++) { if (peopleCtrl [loop1].getName() == passengers [loop]) { peopleCtrl [loop1].size = toSize; } } } myBoat.move(); } }
public void boatMove() { //判断船是否能开 if (!myBoat.ifEmpty() && myBoat.getRunningState() != "running") { string toSize; string[] passengers = myBoat.getPassengerName(); if (myBoat.size == "left") { toSize = "right"; } else { toSize = "left"; } // 船到另一岸了,因此船上的人物也要到另一岸, for (int loop = 0; loop < 2; loop++) { for (int loop1 = 0; loop1 < numOfPirestOrDevil * 2; loop1++) { if (peopleCtrl [loop1].getName() == passengers [loop]) { peopleCtrl [loop1].size = toSize; } } } //开船 myBoat.move(actionManager); } }