Пример #1
0
    public GameBattleUnit summonUnit(GameBattleUnit u, int id, int x, int y)
    {
        GameBattleUnit battleUnit = getUnitByID(id);

        if (battleUnit == null)
        {
            return(null);
        }

        if (battleUnit.IsShow || battleUnit.IsKilled)
        {
            return(null);
        }

        GameUnit unit = GameUnitData.instance.getData(battleUnit.UnitID);

        battleUnit.IsShow   = true;
        battleUnit.IsSummon = true;

        GameUnitBase unitBaseU = u.getUnitBase();
        GameUnitBase unitBase  = battleUnit.getUnitBase();

        unitBase.LV = unitBaseU.LV;

        unitBase.HP  = (short)(unitBaseU.HP * unit.HP / 100.0f);
        unitBase.MP  = (short)(unitBaseU.MP * unit.MP / 100.0f);
        unitBase.Str = (short)(unitBaseU.Str * unit.Str / 100.0f);
        unitBase.Vit = (short)(unitBaseU.Vit * unit.Vit / 100.0f);
        unitBase.Avg = (short)(unitBaseU.Avg * unit.Avg / 100.0f);
        unitBase.Int = (short)(unitBaseU.Int * unit.Int / 100.0f);
        unitBase.Luk = (short)(unitBaseU.Luk * unit.Luk / 100.0f);

        battleUnit.updateUnitData();

        battleUnit.initHPMP();
        battleUnit.clearMove();

        battleUnit.setPos(x, y);
        battleUnit.updateAnimation(GameAnimationDirection.South);
        battleUnit.updateAlive();

        return(battleUnit);
    }
Пример #2
0
    public void showUnits(int e)
    {
        GameBattleStage stage = GameBattleManager.instance.ActiveBattleStage;

        for (int i = 0; i < stage.Man.Length; i++)
        {
            GameBattleMan man = stage.Man[i];

            if (man.EventParm1 == e)
            {
                GameBattleUnit unit = GameBattleUnitManager.instance.getUnit(i);

                GameUnitMove unitMove = GameUnitMoveTypeData.instance.getData(unit.MoveType);

                GameBattleUnit unit1 = GameBattleUnitManager.instance.getUnit(unit.PosX, unit.PosY);

                if (unit != unit1 &&
                    unit1 != null)
                {
                    GameBattlePathFinder.instance.findNearPos(unit.PosX, unit.PosY, unitMove.block);

                    unit.setPos(GameBattlePathFinder.instance.nearPosX,
                                GameBattlePathFinder.instance.nearPosY);
                }

//                 if ( GameBattlePathFinder.instance.isBlockPos( unit.PosX , unit.PosY , unitMove.block , unit ) )
//                 {
//                     GameBattlePathFinder.instance.findNearPos( unit.PosX , unit.PosY , unitMove.block );
//
//                     unit.setPos( GameBattlePathFinder.instance.nearPosX ,
//                         GameBattlePathFinder.instance.nearPosY );
//                 }

                unit.IsShow = true;

                unit.updateAlive();
                unit.playAnimationBattle(GameAnimationType.Stand,
                                         GameAnimationDirection.South, null);
                unit.updateInteam();
            }
        }
    }
Пример #3
0
    public GameBattleUnit reliveSummonUnit(int x, int y)
    {
        GameBattleUnit unit = getKilledSummonUnit();

        if (unit == null)
        {
            return(null);
        }

        unit.IsShow   = true;
        unit.IsKilled = false;

        unit.addHP(1);
        unit.clearMove();

        unit.setPos(x, y);
        unit.updateAnimation(GameAnimationDirection.South);
        unit.updateAlive();

        return(unit);
    }
Пример #4
0
    public void showUnits(int parm, int check)
    {
        bool b = false;

        GameBattleMan[] Man   = GameBattleManager.instance.ActiveBattleStage.Man;
        GameBattleStage stage = GameBattleManager.instance.ActiveBattleStage;

        for (int i = 0; i < Man.Length; i++)
        {
            GameBattleMan man = Man[i];

            if (man.EventParm1 == parm)
            {
                GameBattleUnit unit = GameBattleUnitManager.instance.getUnit(i);

                //                 if ( unit.IsKilled )
                //                 {
                //                     unit.initHPMP();
                //                     GameBattleXY xy = stage.XY[ i ];
                //                     unit.setPos( xy.X , xy.Y );
                //                 }

                if (unit.IsAlive)
                {
                    unit.setPos(stage.XY[unit.BattleManID].X, stage.XY[unit.BattleManID].Y);
                }

                GameUnitMove unitMove = GameUnitMoveTypeData.instance.getData(unit.MoveType);

                GameBattleUnit unit1 = GameBattleUnitManager.instance.getUnit(unit.PosX, unit.PosY);

                if (check == 1 &&
                    unit != unit1 &&
                    unit1 != null)
                {
                    GameBattlePathFinder.instance.findNearPos(unit.PosX, unit.PosY, unitMove.block);

                    unit.setPos(GameBattlePathFinder.instance.nearPosX,
                                GameBattlePathFinder.instance.nearPosY);
                }

                if (check == 1 &&
                    GameBattlePathFinder.instance.isBlockPos(unit.PosX, unit.PosY, unitMove.block, unit))
                {
                    GameBattlePathFinder.instance.findNearPos(unit.PosX, unit.PosY, unitMove.block);

                    unit.setPos(GameBattlePathFinder.instance.nearPosX,
                                GameBattlePathFinder.instance.nearPosY);
                }

                unit.IsShow = true;
                //                            unit.IsActed = true;

                if (unit.IsKilled)
                {
                    unit.IsKilled = false;
                    unit.setAlpha(1.0f);
                    unit.gameObject.SetActive(true);
                }


                unit.updateAlive();
                unit.playAnimationBattle(GameAnimationType.Stand,
                                         GameAnimationDirection.South, null);
                unit.updateInteam();

//                 if ( !b && GameBattleTurn.instance.Turn > 1 )
//                 {
//                     if ( GameUserData.instance.Stage == 12 && parm == 4 )
//                     {
//                         // stage 12 bug
//                         continue;
//                     }
//
//                     b = true;
//
//                     GameBattleCursor.instance.show();
//                     GameBattleCursor.instance.moveTo( unit.PosX , unit.PosY ,
//                                     GameBattleCursor.SpeedX , GameBattleCursor.SpeedY ,
//                                      onShowUnitOver );
//                 }
            }
        }

        GameBattleUnitManager.instance.resetEnemyAI();

        if (!b)
        {
            onShowUnitOver();
        }
    }