Пример #1
0
    public void ClickCharacter(Character input)
    {
        if (input.characterStatus == 1)//0在岸上,1在船上
        {
            Coast coast;
            Debug.Log(boat.BoatPosStatus);
            if (boat.BoatPosStatus == -1)
            {
                coast = LeftCoast;
            }
            else
            {
                coast = RightCoast;
            }
            boat.GetOffBoat(input.getName());
            Debug.Log(coast.getEmptyPosition());
            input.moveToPosition(coast.getEmptyPosition());
            input.getOnCoast(coast);
            coast.getOnCoast(input);
        }
        else
        {
            Coast coast = input.getCoast();

            if (boat.getEmptyIndex() == -1)
            {
                return;
            }
            //Debug.Log(coast.TypeOfCoast);
            //Debug.Log(boat.BoatPosStatus);
            //Debug.Log(coast.TypeOfCoast);
            //Debug.Log(boat.BoatPosStatus);
            if (coast.TypeOfCoast != boat.BoatPosStatus)
            {
                return;
            }
            //Debug.Log("ClickCharacter");
            coast.getOffCoast(input.getName());
            //Debug.Log(boat.getEmptyPosition());
            input.moveToPosition(boat.getEmptyPosition());
            input.getOnBoat(boat);
            boat.GetOnBoat(input);
        }
        Debug.Log(gameStatus());
        simplegui.status = gameStatus();
    }
Пример #2
0
 public void OnClickedCharacter(Character characterController)
 {
     if (ifGameover)
     {
         return;
     }
     if (characterController.isOnBoat())
     {
         Coast whichCoast;
         if (boat.getToOrFrom() == -1)
         {
             whichCoast = toCoast;
         }
         else
         {
             whichCoast = fromCoast;
         }
         boat.GetOffBoat(characterController.getName());
         actionManager.moveCharacter(characterController.getGameObject(), whichCoast.getEmptyPosition());
         characterController.getOnCoast(whichCoast);
         whichCoast.getOnCoast(characterController);
     }
     else
     {
         Coast whichCoast = characterController.getCoastController();
         if (boat.getEmptyIndex() == -1)
         {
             return;                             //boat is full;
         }
         if (whichCoast.getStartOrEnd() != boat.getToOrFrom())
         {
             return;                                                     //不在同一侧
         }
         whichCoast.getOffCoast(characterController.getName());
         actionManager.moveCharacter(characterController.getGameObject(), boat.getEmptyPosition());
         //characterController.moveToPosition();
         characterController.getOnBoat(boat);
         boat.GetOnBoat(characterController);
     }
     userGUI.status = checkGameOver();
     ifGameover     = userGUI.status != 0 ? true : false;
 }