Пример #1
0
    /// <summary>
    /// 如果点了某个人物,判断其是在船上还是陆地上
    /// 如果在船上,则上岸;否则,上船
    /// </summary>
    /// <param name="chac">某个人</param>
    public void isClickCha(ChaController chac)
    {
        //上岸
        if (chac.isOnBoat())
        {
            LandController whichLand;
            if (boat.getOnWhere() == -1)
            {
                whichLand = toLand;
            }
            else
            {
                whichLand = fromLand;
            }

            boat.getOffBoat(chac.getChaName());
            //chac.movePosition(whichLand.getEmptyPosition());
            // chac.setDestination(whichLand.getEmptyPosition());
            actionManager.moveCharacter(chac, whichLand.getEmptyPosition());//动作执行
            chac.getOnLand(whichLand);
            whichLand.getOnLand(chac);
        }
        //上船
        else
        {
            LandController whichLand = chac.getLandCont();
            if (boat.getEmptyIndex() == -1)
            {
                return;
            }
            if (whichLand.getSide() != boat.getOnWhere())
            {
                return;
            }

            whichLand.getOffLand(chac.getChaName());
            //chac.movePosition(boat.getEmptyPos());
            // chac.setDestination(boat.getEmptyPos());
            actionManager.moveCharacter(chac, boat.getEmptyPos());//动作执行
            chac.getOnBoat(boat);
            boat.getOnBoat(chac);
        }
        userGUI.Status = isOver();//判断游戏是否已经达到了结束的条件
    }