protected void setDefaultHitRange(AniData aniData, bool useHitRangeAsAttackRange)
 {
     hitRange = aniData.hitRange * monsterData.scale;
     if (useHitRangeAsAttackRange)
     {
         stat.atkRange = hitRange;
     }
 }
Exemple #2
0
 private void loadEffectFromAnimationData(AniData ani, bool isDefault = false)
 {
     if (ani.effectNum <= 0)
     {
         return;
     }
     for (int i = ani.effectNum - 1; i >= 0; --i)
     {
         addLoadEffectData(ani.effect[i].id, isDefault);
     }
 }
Exemple #3
0
    public void convertClipboardDataToAniData(string clipboard)
    {
        if (Application.isPlaying)
        {
            clipboard = clipboard.Trim();

            string[] lines = clipboard.Split(new string[] { "\r\n", "\n" }, System.StringSplitOptions.None);

            int len = lines.Length;

            for (int i = 0; i < len; ++i)
            {
                if (string.IsNullOrEmpty(lines[i]))
                {
                    continue;
                }

                string[] singleLines = Util.CsvParser(lines[i]);

                if (singleLines[0] != "ANIDATA")
                {
                    Debug.LogError("잘못된 데이터입니다.");
                }
                else
                {
                    AniData aniData = new AniData();
                    aniData.setData(singleLines);

                    GameManager.info.aniData[aniData.id][aniData.ani] = aniData;
                }
            }


            for (int i = 0; i < GameManager.me.characterManager.playerMonster.Count; ++i)
            {
                GameManager.me.characterManager.setCharacterShootingPointAndEffectContainer(GameManager.me.characterManager.playerMonster[i]);
            }

            for (int i = 0; i < GameManager.me.characterManager.monsters.Count; ++i)
            {
                GameManager.me.characterManager.setCharacterShootingPointAndEffectContainer(GameManager.me.characterManager.monsters[i]);
            }
        }
    }
    public void setAniData(string aniId)
    {
#if UNITY_EDITOR
        if (DebugManager.instance.useDebug && UnitSkillCamMaker.instance.useEffectSkillCamEditor)
        {
            try
            {
                if (GameManager.info.aniData[resourceId].ContainsKey(aniId))
                {
                    _tempAniData = GameManager.info.aniData[resourceId][aniId];
                }
                else
                {
                    _tempAniData = GameManager.info.aniData[resourceId][ATK];
                }

                if (string.IsNullOrEmpty(_tempAniData.link) == false)
                {
                    _tempAniData = GameManager.info.aniData[resourceId][_tempAniData.link];
                }
            }
            catch
            {
                _tempAniData = new AniData();
            }
        }
        else
#endif
        {
            if (GameManager.info.aniData[resourceId].TryGetValue(aniId, out _tempAniData) == false)
            {
                _tempAniData = GameManager.info.aniData[resourceId][ATK];
            }

            if (string.IsNullOrEmpty(_tempAniData.link) == false)
            {
                _tempAniData = GameManager.info.aniData[resourceId][_tempAniData.link];
            }
        }
    }
Exemple #5
0
    public void changeAni(int type, bool isPlayerSide, AniData aniData, EffectEditorData.EffectEditBulletData bulletData, string customAniName = null)
    {
        if (prevCreatedUnit == null)
        {
            return;
        }

        CURRENT_ANI_NAME = customAniName;

        UnitData un = GameManager.info.unitData["UN10100101"];

        bulletPattern.ids[0] = "B0";

        BulletData bd = new BulletData();

        bd.destroy          = false;
        bd.useDestroyEffect = false;
        bd.hp = 0;
        bd.hitActionReward  = new Reward(null);
        bd.deadActionReward = new Reward(null);
        bd.destoryAction    = new Reward(null);

        GameManager.info.bulletData["B0"] = bd;

        bd.attachEffectToShotPoint = bulletData.bulletEffect.attachedToParent;
        bd.id = "B0";



        if (type == 0)
        {
            type = 1;
        }

        if (bulletData.attackType >= 3)
        {
            type = bulletData.attackType;
        }

        AttackData ad = null;

        int[] opt = bulletData.atkTypeOptions(type).ToArray();
        ad = AttackData.getAttackData(type, opt[0], opt[1], opt[2], opt[3], opt[4], opt[5], opt[6]);

        if (ad != null)
        {
            un.attackType = ad;
            un.attackType.init(AttackData.AttackerType.Unit, AttackData.AttackType.Attack);
        }


        if (prevCreatedUnit != null)
        {
            prevCreatedUnit.unitData = un;
        }

        if (prevCreatedEnemy != null)
        {
            prevCreatedEnemy.unitData = un;
        }

        Monster mon = null;
        Dictionary <string, AniData> dic = null;

#if UNITY_EDITOR
        if (aniData.effect != null)
        {
            foreach (AniDataEffect ade in aniData.effect)
            {
                if (ade.goEffect != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = ade.id;
                    ed.resource = ade.goEffect.name;

                    ed.type = EffectData.ResourceType.PARTICLE;

                    GameManager.info.effectData[ed.id] = ed;

                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, ade.goEffect);
                }
            }
        }
#endif

        aniData.effectNum = ((aniData.effect == null)?0:aniData.effect.Length);


        if (bulletData.use)
        {
                        #if UNITY_EDITOR
            for (int i = 0; i < 1; ++i)
            {
                if (bulletData.bulletEffect.effect != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = "E_" + bulletData.bulletEffect.effect.name.ToString().ToUpper();
                    ed.resource = bulletData.bulletEffect.effect.name.ToString();

                    if (bulletData.bulletEffect.type == EffectEditorData.EffectEditBulletDetailData.Type.Object)
                    {
                        ed.type = EffectData.ResourceType.PREFAB;
                    }
                    else
                    {
                        ed.type = EffectData.ResourceType.PARTICLE;
                    }

                    GameManager.info.effectData[ed.id] = ed;



                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, bulletData.bulletEffect.effect);

                    string effStr = "";

                    switch (bulletData.bulletEffect.type)
                    {
                    case EffectEditorData.EffectEditBulletDetailData.Type.Indie:
                        effStr = "IE:";
                        break;

                    case EffectEditorData.EffectEditBulletDetailData.Type.Object:
                        effStr = "P:";
                        break;

                    case EffectEditorData.EffectEditBulletDetailData.Type.Particle:
                        effStr = "E:";
                        break;
                    }

                    effStr += ed.id + ",";

                    effStr += (bulletData.bulletEffect.attachedToParent?"Y":"N") + ",";

                    effStr += "";                    //(bulletData.bulletEffect.useOption?"Y":"N") + "";

                    bd.setEffect(effStr);
                }
                else
                {
                    bd.setEffect(string.Empty);
                }
            }


            for (int i = 0; i < 1; ++i)
            {
                if (bulletData.bulletEffect.goHitEffect != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = "E_" + bulletData.bulletEffect.goHitEffect.name.ToString().ToUpper();
                    ed.resource = bulletData.bulletEffect.goHitEffect.name.ToString();

                    ed.type = EffectData.ResourceType.PARTICLE;

                    GameManager.info.effectData[ed.id] = ed;

                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, bulletData.bulletEffect.goHitEffect);

                    bd.hitEffect         = ed.id;
                    bulletPattern.ids[1] = ed.id;
                }
                else
                {
                    bd.hitEffect = string.Empty;
                }
            }



            for (int i = 0; i < 1; ++i)
            {
                if (bulletData.bulletEffect.goGroundEffect != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = "E_" + bulletData.bulletEffect.goGroundEffect.name.ToString().ToUpper();
                    ed.resource = bulletData.bulletEffect.goGroundEffect.name.ToString();

                    ed.type = EffectData.ResourceType.PARTICLE;

                    GameManager.info.effectData[ed.id] = ed;

                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, bulletData.bulletEffect.goGroundEffect);
                }
            }

            for (int i = 0; i < 1; ++i)
            {
                if (bulletData.bulletEffect.goDestroyEffect != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = "E_" + bulletData.bulletEffect.goDestroyEffect.name.ToString().ToUpper();
                    ed.resource = bulletData.bulletEffect.goDestroyEffect.name.ToString();

                    ed.type = EffectData.ResourceType.PARTICLE;

                    GameManager.info.effectData[ed.id] = ed;

                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, bulletData.bulletEffect.goDestroyEffect);

                    bd.useDestroyEffect = true;
                    bd.destroyEffectId  = ed.id;

                    if (bulletData.bulletEffect.destroyOption == EffectEditorData.EffectEditBulletDetailData.DestroyEffType.BulletRotation)
                    {
                        bd.destroyEffectOption = BulletData.DestroyEffectOptionType.UseBulletRotation;
                    }
                    else
                    {
                        bd.destroyEffectOption = BulletData.DestroyEffectOptionType.Normal;
                    }
                }
                else
                {
                    bd.useDestroyEffect = false;
                    bd.destroyEffectId  = string.Empty;
                }
            }


            for (int i = 0; i < 1; ++i)
            {
                if (bulletData.bulletEffect.chainLighting != null)
                {
                    EffectData ed = new EffectData();
                    ed.id       = "E_" + bulletData.bulletEffect.chainLighting.name.ToString().ToUpper();
                    ed.resource = bulletData.bulletEffect.chainLighting.name.ToString();

                    ed.type = EffectData.ResourceType.CHAIN;

                    GameManager.info.effectData[ed.id] = ed;

                    bulletPattern.ids[0] = ed.id;

                    UnitSkillCamMaker.instance.usePrefabEffect = true;
                    GameManager.resourceManager.setPrefabFromAssetBundle(ed, null, bulletData.bulletEffect.chainLighting.gameObject);
                }
            }
                        #endif


            aniData.delayLength = bulletData.actionFrame.Count;
            aniData.delay       = new float[aniData.delayLength];

            for (int i = 0; i < bulletData.actionFrame.Count; ++i)
            {
                aniData.delay[i] = ((float)bulletData.actionFrame[i]) / 30f;
            }

            aniData.shootingPointLength = bulletData.shotPoint.Count;
            aniData.shootingPositions   = new int[aniData.shootingPointLength][];

            for (int i = 0; i < aniData.shootingPointLength; ++i)
            {
                aniData.shootingPositions[i]    = new int[3];
                aniData.shootingPositions[i][0] = (int)(bulletData.shotPoint[i].x);
                aniData.shootingPositions[i][1] = (int)(bulletData.shotPoint[i].y);
                aniData.shootingPositions[i][2] = (int)(bulletData.shotPoint[i].z);
            }

            if (bulletData.targetTransform.Count > 0)
            {
                aniData.shootingPoint      = bulletData.targetTransform.ToArray();
                aniData.shootingHandLength = aniData.shootingPoint.Length;
            }
            else
            {
                aniData.shootingPoint      = new string[0];
                aniData.shootingHandLength = aniData.shootingPoint.Length;
            }
        }
        else
        {
            aniData.delayLength         = 1;
            aniData.delay               = new float[] { 1 };
            aniData.shootingPointLength = 0;
            aniData.shootingPoint       = new string[0];
            aniData.shootingHandLength  = aniData.shootingPoint.Length;
        }

//		if(bulletData.actionFrame.Count > 0)

        if (isPlayerSide && prevCreatedUnit != null)
        {
            if (prevCreatedUnit == null)
            {
                return;
            }
            mon = prevCreatedUnit;

            if (GameManager.info.aniData.TryGetValue(mon.resourceId, out dic) == false)
            {
                dic = new Dictionary <string, AniData>();
                GameManager.info.aniData.Add(mon.resourceId, dic);
            }

            if (dic.ContainsKey(aniData.ani))
            {
                dic[aniData.ani] = aniData;
            }
            else
            {
                dic.Add(aniData.ani, aniData);
            }

            GameManager.me.characterManager.setCharacterShootingPointAndEffectContainer(mon);

            if (GameManager.me.characterManager.monsters.Count > 0)
            {
                try
                {
                    mon.setTarget(GameManager.me.characterManager.monsters[0]);
                    mon.unitData.attackType.lookTargetAndAttack(mon, GameManager.me.characterManager.monsters[0], mon.unitData.attackType.isShortType);
                }
                catch
                {
                }
            }
        }
        else if (prevCreatedEnemy != null)
        {
            if (prevCreatedEnemy == null)
            {
                return;
            }
            mon = prevCreatedEnemy;

            if (GameManager.info.aniData.TryGetValue(mon.resourceId, out dic) == false)
            {
                dic = new Dictionary <string, AniData>();
                GameManager.info.aniData.Add(mon.resourceId, dic);
            }

            if (dic.ContainsKey(aniData.ani))
            {
                dic[aniData.ani] = aniData;
            }
            else
            {
                dic.Add(aniData.ani, aniData);
            }

            GameManager.me.characterManager.setCharacterShootingPointAndEffectContainer(mon);

            if (GameManager.me.characterManager.playerMonster.Count > 0)
            {
                try
                {
                    mon.setTarget(GameManager.me.characterManager.playerMonster[0]);
                    mon.unitData.attackType.lookTargetAndAttack(mon, GameManager.me.characterManager.playerMonster[0], mon.unitData.attackType.isShortType);
                }
                catch
                {
                }
            }
        }
    }