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();
            }
        }
    }
Exemple #2
0
    public void showSkill(GameSkill m, GameBattleUnit u, GameBattleAttackMapDirection dir, List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        clear();

        skill = m;
        item  = null;

        unit        = u;
        result      = r;
        direction   = dir;
        onEventOver = over;

        GameUserData.instance.LastSkillID = skill.ID;

        string path = "Prefab/Misc/Mag_misc";

        GameObject    obj           = Instantiate <GameObject>(Resources.Load <GameObject>(path));
        GameAnimation gameAnimation = obj.GetComponent <GameAnimation>();

        gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
        gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y - 18;

        unit.playAnimationBattle(GameAnimationType.Skill, u.Direction, null);

        Transform trans = obj.transform;

        trans.SetParent(transform);
        trans.localScale    = Vector3.one;
        trans.localPosition = Vector3.zero;

        transform.localPosition = new Vector3(unit.PosBattleX,
                                              unit.PosBattleY + GameBattleManager.instance.LayerHeight,
                                              transform.localPosition.z);

        gameAnimation.playAnimation(1, GameDefine.INVALID_ID, false, onStartOver);
    }
Exemple #3
0
    void onAttackOver()
    {
        clear();

        if (skill != null &&
            (skill.BattleType == GameSkillBattleType.Map ||
             skill.BattleType == GameSkillBattleType.Normal))
        {
            unit.playAnimationBattle(GameAnimationType.Stand, unit.Direction, null);
        }

        bool b = false;

        for (int i = 0; i < result.Count; i++)
        {
            string path = "Prefab/Misc/MAN_RES";

            GameBattleUnit u = result[i].unit;

            if (u == null)
            {
                onMoveOver();
                return;
            }

            GameObject    obj           = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            GameAnimation gameAnimation = obj.GetComponent <GameAnimation>();
            gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
            gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y;

            Transform trans = obj.transform;
            trans.SetParent(transform);
            trans.localScale = Vector3.one;
            trans.position   = new Vector3(u.PosBattleX,
                                           u.PosBattleY + GameBattleManager.instance.LayerHeight,
                                           transform.localPosition.z);



            string path1 = "Prefab/JumpHPMap";

            GameObject          obj1   = Instantiate <GameObject>(Resources.Load <GameObject>(path1));
            GameBattleJumpHPMap jumpHP = obj1.GetComponent <GameBattleJumpHPMap>();

            Vector3 screenPos = GameCameraManager.instance.mainCamera.WorldToScreenPoint(trans.position);
            screenPos.z = 0;

            RectTransform trans1 = obj1.GetComponent <RectTransform>();
            trans1.SetParent(GameObject.Find("Canvas/UI/Center/JumpHPMap").transform);
            trans1.localScale       = Vector3.one;
            trans1.position         = screenPos;
            trans1.anchoredPosition = new Vector2(GameDefine.TEXTURE_WIDTH_HALF + trans1.anchoredPosition.x,
                                                  trans1.anchoredPosition.y - GameDefine.TEXTURE_HEIGHT);

            jumpHPlist.Add(jumpHP);

            int animationStart = 2;
            int animationEnd   = 10;

            switch (result[i].type)
            {
            case GameSkillResutlType.Damage:
                animationStart = 2;
                animationEnd   = 10;
                break;

            case GameSkillResutlType.Cure:
                animationStart = 46;
                animationEnd   = 60;
                break;

            case GameSkillResutlType.Purge:
                animationStart = 60;
                animationEnd   = 81;
                break;

            case GameSkillResutlType.Blessing:
                animationStart = 18;
                animationEnd   = 32;
                break;

            case GameSkillResutlType.Curse:
                animationStart = 32;
                animationEnd   = 46;
                break;

            case GameSkillResutlType.None:
            case GameSkillResutlType.Special:
            {
                animationStart = 81;
                animationEnd   = 99;

                if (result[i].HP > 0 || result[i].MP > 0)
                {
                    if (skill != null &&
                        (skill.OtherEffect == GameSkillOtherEffect.HealAll ||
                         skill.OtherEffect == GameSkillOtherEffect.MPAdd))
                    {
                        animationStart = 46;
                        animationEnd   = 60;
                    }
                    else
                    {
                        animationStart = 2;
                        animationEnd   = 10;
                    }
                }
            }
            break;
            }

            OnEventOver over = null;

            if (result[i].type == GameSkillResutlType.Damage || result[i].HP != 0 || result[i].MP != 0)
            {
                over = onResOver;
            }
            else
            {
                over = onJumpHPOver;
            }

            b = true;

            gameAnimation.playSound = (i == 0);

            if (i == 0)
            {
                gameAnimation.playAnimation(animationStart, animationEnd, false, over);
            }
            else
            {
                gameAnimation.playAnimation(animationStart, animationEnd, false, null);
            }
        }

        if (!b)
        {
            onJumpHPOver();
        }
    }
    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();
        }
    }