예제 #1
0
    void onStartMoveOver()
    {
        string path = "";

        int offsetX = 0;
        int offsetY = 0;

        switch (skill.BattleType)
        {
        case GameSkillBattleType.Normal:
        {
            path  = "Prefab/Magic/magic" + GameDefine.getString3(skill.AnimationID) + "/";
            path += "M";
            path += skill.AnimationID;
        }
        break;

        case GameSkillBattleType.UI:
        {
            return;
        }

        case GameSkillBattleType.Map:
        {
            if (skill.AnimationID > 0 && skill.BattleSprite == 0)
            {
                path  = "Prefab/Magic/magic" + GameDefine.getString3(skill.AnimationID) + "/";
                path += "M";
                path += skill.AnimationID;
            }
            else
            {
                unit.stopAnimation();
                unit.clearAnimation();

                path = "Prefab/Sprite/man" + GameDefine.getString3(unit.Sprite) + "/" +
                       GameDefine.getString3(unit.Sprite);
                path += (skill.BattleSprite > 0 ? "-" + skill.BattleSprite : "");
                path += "s";

//                         offsetX = GameDefine.TEXTURE_WIDTH_HALF - 5;
//                         offsetY = GameDefine.TEXTURE_HEIGHT_HALF;
            }
        }
        break;

        case GameSkillBattleType.UIMap:
        {
            path = "Prefab/Sprite/man" + GameDefine.getString3(unit.Sprite) + "/" +
                   GameDefine.getString3(unit.Sprite);
            path += (skill.BattleSprite > 0 ? "-" + skill.BattleSprite : "");
            path += "sm";
        }
        break;
        }

        clear();

        GameObject obj1 = Resources.Load <GameObject>(path);

        if (obj1 == null)
        {
            onAttackOver();
            return;
        }

        GameObject    obj = Instantiate <GameObject>(obj1);
        GameAnimation attackerAnimation = obj.GetComponent <GameAnimation>();

        attackerAnimation.offsetX = offsetX;
        attackerAnimation.offsetY = offsetY;

        Transform trans = obj.transform;

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

        GameBattleSceneMovement.instance.updatePositionToCamera();

        transform.localPosition = new Vector3(GameBattleSceneMovement.instance.PosXReal,
                                              GameBattleSceneMovement.instance.PosYReal + GameBattleManager.instance.LayerHeight,
                                              transform.localPosition.z);

        attackerAnimation.transform.localScale = new Vector3(GameCameraManager.instance.sceneWidth / GameDefine.SCENE_WIDTH, 1.0f, 1.0f);

        if (direction != GameBattleAttackMapDirection.Count)
        {
            int c = attackerAnimation.safHead.count3[0];
            int f = c * (int)direction;

            attackerAnimation.playAnimation(f, f + c, false, onAttackOver);
        }
        else
        {
            attackerAnimation.playAnimation(0, GameDefine.INVALID_ID, false, onAttackOver);
        }
    }