Example #1
0
    public void InitBornPoint(ObjectCreature obj)
    {
        Transform _tran = GetTransform(obj.GetGameObject().transform, m_SpellInfo.GetSpellRow().getBullEffectPoint());

        if (_tran == null)
        {
            LogManager.LogError("!!!Error: [InitBornPoint]弹道特效" + obj.GetGameObject() + "目标发射点位置获取错误:" + m_SpellInfo.GetSpellRow().getBullEffectPoint() + "  技能ID:" + m_SpellInfo.GetSpellRow().getId());
            return;
        }
        SetCasterObj(obj);
        SetInitialLocation(_tran.position);
    }
Example #2
0
    public void InitTargetPoint(ObjectCreature obj)
    {
        if (obj == null || obj.GetGameObject() == null)
        {
            return;
        }
        Transform _tran = GetTransform(obj.GetGameObject().transform, m_SpellInfo.GetSpellRow().getEffectHitPoint());

        if (_tran == null)
        {
            LogManager.LogError("!!!Error: [InitTargetPoint]弹道特效" + obj.GetGameObject() + "目标命中点位置获取错误:" + m_SpellInfo.GetSpellRow().getEffectHitPoint() + "  技能ID:" + m_SpellInfo.GetSpellRow().getId());
            return;
        }

        SetTargetLocation(_tran.position);

        TargetObj = _tran.gameObject;

        targetPos      = new Vector3(TargetObj.transform.position.x, TargetObj.transform.position.y, TargetObj.transform.position.z);
        TargetCreature = obj;
    }
Example #3
0
        private void AddLinkEff()
        {
            if (m_pSpellInfo.GetSpellRow().getUnderAttackEffLink() == -1)
            {
                return;
            }
            List <ObjectCreature> tempobjlist = new List <ObjectCreature>();

            for (int i = 0; i < m_TargetList.m_nCount; ++i)
            {
                tempobjlist.Add(m_TargetList.m_pObjectList[i].m_pTargetObject);
            }
            EffectManager.GetInstance().InstanceEffect_Link(m_pSpellInfo.GetSpellRow().getBallIsticEffID()[0], m_pHolder, m_pHolder.GetGameObject().transform.position, tempobjlist);
        }
Example #4
0
        public void InitLogic(int TemplateID, int Priority, ObjectCreature ReleaseObj, SpellInfo info, float timeInterval)
        {
            m_TempSkillTag.Clear();
            m_Oneself.Clear();
            m_Enemy.Clear();

            m_TemplateID   = TemplateID;
            m_ReleaseObj   = ReleaseObj;
            m_Priority     = Priority;
            m_Spellinfo    = info;
            m_ID           = ReleaseObj.GetGameObject().GetInstanceID();
            m_Tempai       = (SkillaiTemplate)DataTemplate.GetInstance().m_SkillaiTable.getTableData(m_TemplateID);
            m_TimeInterval = timeInterval;

            curState = LogicState.EM_LOGICSTATE_USE;
        }
Example #5
0
        public bool __CalculateSpellTarget(ref FIGHTOBJECT_LIST targetlist)
        {
            targetlist.m_pObjectList.Clear();
            LogManager.LogAssert(m_pHolder);
            LogManager.LogAssert(m_pSpellInfo);
            SkillTemplate pRow = m_pSpellInfo.GetSpellRow();

            LogManager.LogAssert(pRow);
            switch (m_pSpellInfo.GetTargetType())
            {
            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                    }
                }
                else if (pRow.getCoverage() < 0.0f)
                {
                    SceneObjectManager pScene = SceneObjectManager.GetInstance();
                    LogManager.LogAssert(pScene);
                    SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                    init.m_Type = m_pSpellInfo.GetTargetType();
                    pScene.ScanByObject(m_pHolder, ref init);
                    for (int j = 0; j < init.m_ObjectList.Count; j++)
                    {
                        targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                    }
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetSceneObjectByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                    }
                }
                else if (pRow.getCoverage() < 0.0f)
                {
                    SceneObjectManager pScene = SceneObjectManager.GetInstance();
                    LogManager.LogAssert(pScene);
                    SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                    init.m_Type = m_pSpellInfo.GetTargetType();
                    pScene.ScanByObject(m_pHolder, ref init);
                    for (int j = 0; j < init.m_ObjectList.Count; j++)
                    {
                        targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                    }
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_SELF:
            {
                targetlist.Add((ObjectCreature)m_pHolder);
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ALL:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_NO_SELF:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_MIN_HPPERCENT:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ALL_NO_SELF:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_MIN_HPPERCENT:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ATTACK_ME:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                if (pTarget != null)
                {
                    targetlist.Add((ObjectCreature)pTarget);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_RAND:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_IMPACT_CASTER:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                if (pTarget != null)
                {
                    targetlist.Add((ObjectCreature)pTarget);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_RAND:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                int m_Tagnum = m_pSpellInfo.GetBaseSpellTargetNumber();
                pScene.ScanByObject(m_pHolder, ref init, m_Tagnum);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                        SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                        init.m_Type = m_pSpellInfo.GetTargetType();
                        pScene.ScanByObject(m_pHolder, ref init, m_pSpellInfo.GetBaseSpellTargetNumber(), pTarget);
/*                                targetlist.m_pObjectList.Clear();*/

                        for (int j = 0; j < init.m_ObjectList.Count; j++)
                        {
                            targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                        SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                        init.m_Type = m_pSpellInfo.GetTargetType();
                        pScene.ScanByObject(m_pHolder, ref init, m_pSpellInfo.GetBaseSpellTargetNumber(), pTarget);
                        for (int j = 0; j < init.m_ObjectList.Count; j++)
                        {
                            targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_SELF_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetSceneObjectByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                            int m_Tagnum = m_pSpellInfo.GetBaseSpellTargetNumber();
                            if (pTarget.GetGameObject().GetHashCode() != m_pHolder.GetGameObject().GetHashCode())
                            {
                                targetlist.Add((ObjectCreature)m_pHolder);
                            }
                            else
                            {
                                m_Tagnum = m_Tagnum + 1;
                            }

                            SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                            init.m_Type = m_pSpellInfo.GetTargetType();
                            pScene.ScanByObject(m_pHolder, ref init, m_Tagnum, pTarget);
                            for (int j = 0; j < init.m_ObjectList.Count; j++)
                            {
                                targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                            }
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            default:
                break;
            }
            return(true);
        }
Example #6
0
    /// <summary>
    /// 实例化一个静态effect
    /// </summary>
    /// <param name="effectName">要实例化的特效名称</param>
    /// <param name="parent">实例化特效依附的父类挂点</param>
    /// <param name="lifetime">是否重置指定的生存时间,默认为特效对象上的Light组件获得</param>
    /// <param name="isAttach">是否需要依附,默认不依附任何挂点</param>
    public void InstanceEffect_Static(string effectName, ObjectCreature pCaster, Transform parent, float lifetime = 0f, bool isAttach = false)
    {
        EffectStatic _effect = GetFreeEffectStatic(effectName);

        if (_effect != null && _effect.GetGameObject() != null)
        {
            GameObject obj = _effect.GetGameObject();
            obj.transform.position = parent.position;
            obj.transform.rotation = parent.transform.rotation;
            _effect.SetCasterObj(pCaster);
            if (isAttach)
            {
                obj.transform.parent = parent;
            }
            _effect.ResetTime();
            _effect.SetActivation(true);
        }
        else
        {
            GameObject _AssetRes = AssetLoader.Inst.GetAssetRes(effectName);
            if (_AssetRes == null)
            {
                LogManager.LogError("!!!!Error:InstanceEffect_Static() effectRes is null!The effectName:" + effectName + "GameObject is:" + pCaster.GetGameObject() + "effect location:" + parent.name);
                return;
            }

            EffectStatic _newEffect = new EffectStatic();

            GameObject _obj = Instantiate(_AssetRes, parent.position, parent.transform.rotation) as GameObject;
            if (pCaster is ObjectMonster)
            {
                float _scale = ((ObjectMonster)pCaster).GetMonsterRow().getMonsterEnlarge();
                _obj.transform.localScale = new UnityEngine.Vector3(_scale, _scale, _scale);
            }
            GameUtils.AttachParticleCS(_obj.transform);
            if (isAttach)
            {
                _obj.transform.parent = parent;
            }
            _newEffect.SetGameObject(_obj);
            _newEffect.SetCasterObj(pCaster);
            _newEffect.SetEffectName(effectName);
            //if (lifetime > 0f)
            //{
            //    _newEffect.SetLiftTime(lifetime);
            //}

            m_EffectStaticList.Add(_newEffect);
        }
    }