Пример #1
0
    public void ItemClick(ItemControl itemCtrl)
    {
        Debug.Log("ItemClick");
        if (itemCtrl.isOnBoat)
        {
            ShoreControl side;
            if (boat.status == 1)
            {
                side = fromShore;
            }
            else
            {
                side = toShore;
            }

            Debug.Log(side.GetEmptyPosition());
            boat.GetOffBoat(itemCtrl);
            itemCtrl.MoveTo(side.GetEmptyPosition());
            itemCtrl.GetOnShore(side);
            side.GetOnShore(itemCtrl);
            user.step++;
        }
        else
        {
            if (boat.IsFull())
            {
                return;
            }

            Debug.Log(itemCtrl.item.name + " getting on boat");
            ShoreControl side = itemCtrl.shoreCtrl;
            if (side.status != boat.status)
            {
                return;
            }

            side.GetOffShore(itemCtrl.item.name);//
            itemCtrl.MoveTo(boat.GetOnBoat(itemCtrl));
            itemCtrl.GetOnBoat(boat);
            user.step++;
        }
        user.status = Check();
    }