示例#1
0
    void updateAttackSelection()
    {
        if (!GameBattleUnitAttackSelection.instance.IsShow)
        {
            return;
        }

        if (confirm)
        {
            confirm = false;

            //attack

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

            GameBattleUnit defencer = GameBattleUnitManager.instance.getUnit(GameBattleCursor.instance.PosX,
                                                                             GameBattleCursor.instance.PosY);

            GameBattleUnit attacker = GameBattleSelection.instance.SelectionUnit;

            if (defencer != null && attacker != null)
            {
                if (attacker.UnitCampType != defencer.UnitCampType)
                {
                    GameTouchCenterUI.instance.unShowUI();

                    GameBattleAttackResult.instance.PhysicalAttack(attacker, defencer, GameBattleAttackResultSide.Right, onAttackOver);

                    attacker.setDirection(defencer.PosX, defencer.PosY);
                    attacker.move();

                    GameBattleCursor.instance.unShow();
                    GameBattleUnitAttackSelection.instance.unShow();
                    GameBattleUnitActionUI.instance.unShowFade();
                }
            }

            return;
        }

        if (cancel)
        {
            cancel = false;

            GameBattleCursor.instance.unShow();
            GameBattleUnitAttackSelection.instance.unShow();

            GameBattleUnitActionUI.instance.show();
            GameBattleUnitActionUI.instance.enable(true);
            GameBattleUnitActionUI.instance.showFade();

            return;
        }
    }