public void characterIsClicked(MyCharactorController characterCtrl) { if (characterCtrl.isOnBoat()) { shoreController whichShore; if (boat.get_to_or_from() == -1) { // to->-1; from->1 whichShore = toShore; } else { whichShore = fromShore; } boat.GetOffBoat(characterCtrl.getName()); //characterCtrl.moveToPosition(whichShore.getEmptyPosition()); actionManager.moveCharacter(characterCtrl, whichShore.getEmptyPosition()); characterCtrl.getOnShore(whichShore); whichShore.getOnShore(characterCtrl); } else { // character on Shore shoreController whichShore = characterCtrl.getCoastController(); if (boat.getEmptyIndex() == -1) { // boat is full return; } if (whichShore.get_to_or_from() != boat.get_to_or_from()) // boat is not on the side of character { return; } whichShore.getoffShore(characterCtrl.getName()); //characterCtrl.moveToPosition(boat.getEmptyPosition()); if (characterCtrl == null) { Debug.Log("characterCtrl error"); } if (boat.getEmptyPosition() == null) { Debug.Log("boat.getEmptyPosition() error"); } if (actionManager == null) { Debug.Log("actionManager error"); } actionManager.moveCharacter(characterCtrl, boat.getEmptyPosition()); characterCtrl.getOnBoat(boat); boat.GetOnBoat(characterCtrl); } userGUI.status = check_game_over(); }
private void loadCharacter() { for (int i = 0; i < 3; i++) { MyCharactorController cha = new MyCharactorController("priest"); cha.setName("priest" + i); cha.setPosition(fromShore.getEmptyPosition()); cha.getOnShore(fromShore); fromShore.getOnShore(cha); characters[i] = cha; } for (int i = 0; i < 3; i++) { MyCharactorController cha = new MyCharactorController("devil"); cha.setName("devil" + i); cha.setPosition(fromShore.getEmptyPosition()); cha.getOnShore(fromShore); fromShore.getOnShore(cha); characters[i + 3] = cha; } }
public void setController(MyCharactorController _controller) { charactorController = _controller; }