public void loadResources() { fromShore = new shoreController("from"); toShore = new shoreController("to"); boat = new BoatController(); loadCharacter(); }
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(); }