Exemplo n.º 1
0
    public GameBattleMan clone()
    {
        GameBattleMan man = new GameBattleMan();

        man.UnitBase.UnitID          = UnitBase.UnitID;
        man.UnitBase.LV              = UnitBase.LV;
        man.UnitBase.Exp             = UnitBase.Exp;
        man.UnitBase.HP              = UnitBase.HP;
        man.UnitBase.MP              = UnitBase.MP;
        man.UnitBase.Str             = UnitBase.Str;
        man.UnitBase.Int             = UnitBase.Int;
        man.UnitBase.Avg             = UnitBase.Avg;
        man.UnitBase.Vit             = UnitBase.Vit;
        man.UnitBase.Luk             = UnitBase.Luk;
        man.UnitBase.Weapon          = UnitBase.Weapon;
        man.UnitBase.Armor           = UnitBase.Armor;
        man.UnitBase.Accessory       = UnitBase.Accessory;
        man.UnitBase.InTeam          = UnitBase.InTeam;
        man.UnitBase.BaseSpiritPower = UnitBase.BaseSpiritPower;

        for (int i = 0; i < (int)GameSpiritType.Count; i++)
        {
            man.UnitBase.SpiritPower[i] = UnitBase.SpiritPower[i];
        }

        for (int i = 0; i < GameDefine.MAX_SLOT; i++)
        {
            man.UnitBase.Items[i]  = UnitBase.Items[i];
            man.UnitBase.Skills[i] = UnitBase.Skills[i];
        }

        man.BattleManID    = BattleManID;
        man.HpAdd          = HpAdd;
        man.HpSub          = HpSub;
        man.MpAdd          = MpAdd;
        man.MpSub          = MpSub;
        man.EventParm1     = EventParm1;
        man.EventParm2     = EventParm2;
        man.KillGetType    = KillGetType;
        man.KillGetParm1   = KillGetParm1;
        man.killEvent      = killEvent;
        man.UnknowParm88   = UnknowParm88;
        man.BattleAIType   = BattleAIType;
        man.moveToX        = moveToX;
        man.moveToY        = moveToY;
        man.moveToIDUnkonw = moveToIDUnkonw;
        man.moveToID       = moveToID;

        for (int i = 0; i < 10; i++)
        {
            man.UnknowParm92[i] = UnknowParm92[i];
        }

        return(man);
    }
Exemplo n.º 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();
            }
        }
    }
Exemplo n.º 3
0
    void loadMan(int stage)
    {
        string path    = stage < 10 ? "0" + stage.ToString() : stage.ToString();
        string pathDir = Application.dataPath + "/Objects/DAT/Stage/Stage" + path + "/";

        string pathMan = pathDir + "MAN_" + path + ".DAT";

        FileStream fs = File.OpenRead(pathMan);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();

        int index = 0;
        int count = BitConverter.ToInt16(bytes, index); index += 2;

        data[stage].Man = new GameBattleMan[count];


        for (int i = 0; i < count; i++)
        {
            GameBattleMan p = new GameBattleMan();
            p.BattleManID = (short)i;

            p.UnitBase.UnitID = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.LV     = BitConverter.ToInt16(bytes, index); index += 2;
            p.HpAdd           = BitConverter.ToInt16(bytes, index); index += 2;
            p.HpSub           = BitConverter.ToInt16(bytes, index); index += 2;
            p.MpAdd           = BitConverter.ToInt16(bytes, index); index += 2;
            p.MpSub           = BitConverter.ToInt16(bytes, index); index += 2;

            p.UnitBase.Str = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Int = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Avg = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Vit = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Luk = BitConverter.ToInt16(bytes, index); index += 2;

            for (int j = 0; j < (int)GameSpiritType.Count; j++)
            {
                p.UnitBase.SpiritPower[j] = BitConverter.ToInt16(bytes, index); index += 2;
            }
            p.UnitBase.Weapon    = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Armor     = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnitBase.Accessory = BitConverter.ToInt16(bytes, index); index += 2;

            for (int j = 0; j < GameDefine.MAX_SLOT; j++)
            {
                p.UnitBase.Items[j] = BitConverter.ToInt16(bytes, index); index += 2;
            }

            if (p.UnitBase.WeaponSlot == GameDefine.INVALID_ID)
            {
                p.UnitBase.Weapon = GameDefine.INVALID_ID;
            }
            if (p.UnitBase.ArmorSlot == GameDefine.INVALID_ID)
            {
                p.UnitBase.Armor = GameDefine.INVALID_ID;
            }
            if (p.UnitBase.AccessorySlot == GameDefine.INVALID_ID)
            {
                p.UnitBase.Accessory = GameDefine.INVALID_ID;
            }

            for (int j = 0; j < GameDefine.MAX_SLOT; j++)
            {
                p.UnitBase.Skills[j] = BitConverter.ToInt16(bytes, index); index += 2;

#if UNITY_EDITOR
//                 if ( p.UnitBase.Skills[ j ] >= 0 )
//                 {
//                     if ( aaa[ p.UnitBase.Skills[ j ] ] == null )
//                     {
//                         aaa[ p.UnitBase.Skills[ j ] ] = new aaaa();
//                     }
//
//                     GameUnit unit = GameUnitData.instance.getData( p.UnitBase.UnitID );
//                     //                     Debug.LogError( p.UnitBase.Skills[ j ] + " " + p.UnitBase.UnitID + " " + unit.Sprite );
//
//                     aaa[ p.UnitBase.Skills[ j ] ].aa.Remove( unit.Sprite );
//                     aaa[ p.UnitBase.Skills[ j ] ].aa.Add( unit.Sprite );
//                 }
#endif
            }



            p.EventParm1   = BitConverter.ToInt16(bytes, index); index += 2;
            p.EventParm2   = BitConverter.ToInt16(bytes, index); index += 2;
            p.KillGetType  = BitConverter.ToInt16(bytes, index); index += 2;
            p.KillGetParm1 = BitConverter.ToInt16(bytes, index); index += 2;
            p.killEvent    = BitConverter.ToInt16(bytes, index); index += 2;
            p.UnknowParm88 = BitConverter.ToInt16(bytes, index); index += 2;
            p.BattleAIType = (GameBattleAIType)BitConverter.ToInt16(bytes, index); index += 2;

            p.moveToID       = GameDefine.INVALID_ID;
            p.moveToIDUnkonw = GameDefine.INVALID_ID;
            p.moveToX        = GameDefine.INVALID_ID;
            p.moveToY        = GameDefine.INVALID_ID;

            short moveTo0 = BitConverter.ToInt16(bytes, index); index += 2;
            short moveTo1 = BitConverter.ToInt16(bytes, index); index += 2;

            if (p.BattleAIType == GameBattleAIType.AIMoveToUnit)
            {
                p.moveToID       = moveTo1;
                p.moveToIDUnkonw = moveTo0;

                Debug.LogError("AIMoveToUnit " + stage + " " + i + " " + p.moveToIDUnkonw + " " + p.moveToID);
            }

            if (p.BattleAIType == GameBattleAIType.AIMoveToPos)
            {
                p.moveToX = moveTo0;
                p.moveToY = moveTo1;

                Debug.LogError("AIMoveToPos " + stage + " " + i + " " + p.moveToX + " " + p.moveToY);
            }


            for (int j = 0; j < 10; j++)
            {
                p.UnknowParm92[j] = BitConverter.ToInt16(bytes, index); index += 2;
            }

            data[stage].Man[i] = p;
        }
    }
Exemplo n.º 4
0
 public void init(GameUnit u, GameBattleMan m)
 {
     gameUnit      = u;
     gameBattleMan = m;
 }
Exemplo n.º 5
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();
        }
    }