Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
 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);
     }
 }