Пример #1
0
    /// <summary>
    /// 实例化弹道特效
    /// </summary>
    /// <param name="effectName">特效名称</param>
    /// <param name="MasterObj">发起者对象</param>
    /// <param name="TargetObj">目标对象</param>
    /// <param name="_SpellInfo">子弹的技能信息</param>
    public void InstanceEffect_Bullet(string effectName, ObjectCreature MasterObj, ObjectCreature TargetObj, SpellInfo _SpellInfo, EffectHit_Callback HitHandle = null)
    {
        //子弹释放中音效
        AudioControler.Inst.PlaySound(_SpellInfo.GetSpellRow().getBulletsFiredSound());
        //技能弹道的音效
        AudioControler.Inst.PlaySound(_SpellInfo.GetSpellRow().getBallIsticSound());

        EffectSpell _effect = GetFreeEffectSpell(effectName);

        if (_effect != null && _effect.GetGameObject() != null)
        {
            GameObject obj = _effect.GetGameObject();
            _effect.ResetTime();
            _effect.InitBornPoint(MasterObj);
            _effect.InitTargetPoint(TargetObj);
            _effect.SetHitEffectHandle(HitHandle);
            _effect.SetGameObject(obj);
        }
        else
        {
            GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(effectName);
            if (_AssetRes == null)
            {
                return;
            }

            EffectSpell _newEffect = new EffectSpell(_SpellInfo);
            _newEffect.InitBornPoint(MasterObj);
            _newEffect.InitTargetPoint(TargetObj);

            GameObject _obj = Instantiate(_AssetRes, _newEffect.GetInitialLocation(), Quaternion.identity) as GameObject;
            if (MasterObj is ObjectMonster)
            {
                float _scale = ((ObjectMonster)MasterObj).GetMonsterRow().getMonsterEnlarge();
                _obj.transform.localScale = new UnityEngine.Vector3(_scale, _scale, _scale);
            }
            GameUtils.AttachParticleCS(_obj.transform);
            _newEffect.SetGameObject(_obj);
            _newEffect.SetEffectName(effectName);
            _newEffect.SetHitEffectHandle(HitHandle);

            m_EffectSpellList.Add(_newEffect);
        }
        //技能震动
        if (FightEditorContrler.GetInstantiate() != null)
        {
            FightEditorContrler.GetInstantiate().SkillShake(_SpellInfo.GetSpellRow().getVibrationScreen(), EM_SPELL_SHAKE_TYPE.EM_SPELL_SHAKE_TYPE_RELEASE);
        }
    }