public void characterIsClicked(ICharacterController characterCtrl)
    {
        if (characterCtrl.IsOnBoat())
        {
            CoastController whichCoast;
            if (boat.get_to_or_from() == -1)
            {
                whichCoast = toCoast;
            }
            else
            {
                whichCoast = fromCoast;
            }

            boat.GetOffBoat(characterCtrl.getName());
            // characterCtrl.moveTo (whichCoast.getEmptyPosition ());
            actionmanager.MoveCharacter(characterCtrl, whichCoast.getEmptyPosition());
            characterCtrl.getOnCoast(whichCoast);
            whichCoast.getOnCoast(characterCtrl);
        }
        else                                                                                    // character on coast
        {
            CoastController whichCoast = characterCtrl.getCoastController();

            if (boat.getEmptyIndex() == -1)                             // boat is full
            {
                return;
            }

            if (whichCoast.get_to_or_from() != boat.get_to_or_from())                   // boat is not on the side of character
            {
                return;
            }

            whichCoast.getOffCoast(characterCtrl.getName());
            // characterCtrl.moveTo (boat.getEmptyPosition());
            actionmanager.MoveCharacter(characterCtrl, boat.getEmptyPosition());
            characterCtrl.getOnBoat(boat);
            boat.GetOnBoat(characterCtrl);
        }
        userGUI.status = check_game_over();
    }
示例#2
0
 public void CharacterIsClicked(ICharacterController characterController)
 {
     if (characterController.IsOnBoat())
     {
         CoastController whichCoast;
         if (boat.Get_to_or_from() == -1)             // to -1; from 1
         {
             whichCoast = toCoast;
         }
         else
         {
             whichCoast = fromCoast;
         }
         boat.GetOffBoat(characterController.GetName());
         characterController.MoveToPosition(whichCoast.GetEmptyPosition());
         characterController.GetOnCoast(whichCoast);
         whichCoast.GetOnCoast(characterController);
     }
     else
     {
         CoastController whichCoast = characterController.GetCoastController();
         if (boat.GetEmptyIndex() == -1)
         {
             return;
         }
         if (whichCoast.GetToOrFrom() != boat.Get_to_or_from())
         {
             return;
         }
         whichCoast.GetOffCoast(characterController.GetName());
         characterController.MoveToPosition(boat.GetEmptyPosition());
         characterController.GetOnBoat(boat);
         boat.GetOnBoat(characterController);
     }
     userUI.status = CheckGameOver();
 }