Beispiel #1
0
    void updateUnitMove()
    {
        if (!GameBattleUnitMovement.instance.IsShow)
        {
            return;
        }

        if (cancel)
        {
            cancel = false;

            GameBattleUnitMovement.instance.unShow();
            GameBattleSelection.instance.clearSelection();

            return;
        }

        if (confirm)
        {
            confirm = false;

            GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit;

            if (unit != null)
            {
                if (unit.IsMoving)
                {
                    return;
                }

                if (unit.IsActed)
                {
                    GameUnitUI.instance.show(GameBattleSelection.instance.SelectionUnit);
                    GameUnitUI.instance.showFade();
                    return;
                }

                if (!unit.IsUser)
                {
                    GameUnitUI.instance.show(GameBattleSelection.instance.SelectionUnit);
                    GameUnitUI.instance.showFade();
                    return;
                }

                if (!GameBattleUnitMovement.instance.checkCell(GameBattleCursor.instance.PosX,
                                                               GameBattleCursor.instance.PosY))
                {
                    return;
                }

                GameBattleUnitMovement.instance.unShow();

                isMoving = true;

                unit.setOriginalDirection();

                if (GameBattleCursor.instance.PosX == unit.PosX &&
                    GameBattleCursor.instance.PosY == unit.PosY)
                {
                    GameBattleUnitActionUI.instance.show(true, true);
                    GameBattleUnitActionUI.instance.setPos(GameBattleCursor.instance.PosX,
                                                           GameBattleCursor.instance.PosY);
                    GameBattleUnitActionUI.instance.showFade();

                    GameBattleCursor.instance.unShow();

                    isMoving = false;
                }
                else
                {
                    GameTouchCenterUI.instance.unShowUI();

                    unit.moveTo(GameBattleCursor.instance.PosX,
                                GameBattleCursor.instance.PosY, true, true, 2, onMoveOver);

//                    GameBattleSceneMovement.instance.moveTo( unit , onMoveTo );
                }
            }
        }
    }