private void loadResources() { river = new RiverModel(); boat = new BoatModel(); leftCoast = new CoastModel("leftCoast"); rightCoast = new CoastModel("rightCoast"); characters = new CharacterModel[6]; for (int i = 0; i < 3; i++) { characters[i] = new CharacterModel("priest"); characters[i].setPosOnCoast(rightCoast.getVacantIndex()); } for (int i = 3; i < 6; i++) { characters[i] = new CharacterModel("devil"); characters[i].setPosOnCoast(rightCoast.getVacantIndex()); } }
public void moveCharacter(CharacterModel character) { if (boat.isSailing()) { return; } if (character.isOnBoat()) { //character.setCoastName(boat.getCoastName()); character.leaveBoat(); boat.getOff(character.getSeatIndex()); Vector3 newPos; int index; if (character.getCoastName() == "leftCoast") { index = leftCoast.getVacantIndex(); newPos = character.getCoastPosition(index); newPos.x = -newPos.x; } else { index = rightCoast.getVacantIndex(); newPos = character.getCoastPosition(index); } character.setPosIndexOnCoast(index); actionManager.MoveCharacter(character.getCharacter(), newPos, 0.50f); } else { if (boat.isFull() || boat.getCoastName() != character.getCoastName()) { return; } int index = character.getPosIndexOnCoast(); if (character.getCoastName() == "leftCoast") { leftCoast.getOff(character.getPosIndexOnCoast()); } else { rightCoast.getOff(character.getPosIndexOnCoast()); } int seat = boat.getVacantIndex(); character.setSeat(seat); actionManager.MoveCharacter(character.getCharacter(), boat.getBoat().transform.position + character.getBoatPosition(seat), 0.50f); character.board(boat.getBoat().transform); } }
public void moveCharacter(CharacterModel character) { if (boat.isSailing()) { return; } if (character.isOnBoat()) { character.setCoastName(boat.getCoastName()); if (character.getCoastName() == "leftCoast") { character.setPosOnCoast(leftCoast.getVacantIndex()); } else { character.setPosOnCoast(rightCoast.getVacantIndex()); } character.leaveBoat(); boat.getOff(character.getSeatIndex()); if (boat.isEmpty()) { checkGameState(); } } else { if (boat.isFull() || boat.getCoastName() != character.getCoastName()) { return; } character.setSeat(boat.getVacantIndex()); if (character.getCoastName() == "leftCoast") { leftCoast.getOff(character.getPosIndexOnCoast()); } else { rightCoast.getOff(character.getPosIndexOnCoast()); } character.moveWithBoat(boat); } }