Esempio n. 1
0
        public override void Play(ISkillAttacker attacker, SkillEffect se)
        {
            m_ef = se;
            Transform attacker_node = attacker.GetRoot();

            if (attacker_node == null)
            {
                return;
            }


            PlaceFxNodeProp prop = m_NodeProp as PlaceFxNodeProp;

            if (prop == null)
            {
                return;
            }
            // Engine.Utility.Log.Error("play PlaceFxNodeProp {0}", prop.fx_name);
            string stateName  = prop.nodeState;
            int    stateIndex = 0;

            if (!string.IsNullOrEmpty(stateName))
            {
                Client.SkillState state = SkillSystem.GetSkillStateByString(stateName);
                stateIndex = (int)state - 1;
            }
            if (stateIndex < 0)
            {
                stateIndex = 0;
            }
            Vector3 pos = attacker_node.TransformPoint(prop.position);
            //Vector3 vscale = attacker_node.localScale * prop.scale;
            Vector3 vscale = Vector3.one * prop.scale;
            Vector3 angles = attacker_node.eulerAngles;

            angles += prop.rotation;

            if (prop.by_target)
            {
                pos = se.GetPlayEffectInitPos() + prop.position;
            }
            int level = 0;

            if (attacker != null)
            {
                if (attacker.GetSkillPart() != null)
                {
                    level = attacker.GetSkillPart().FxLevel;
                }
            }
            m_uEffectID = helper.ReqPlayFx(prop.fx_name, pos, angles, vscale, level);
            m_startTime = Time.time;
            uint skillID = se.CurSkillID;

            m_curDb = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillID, 1);
            if (m_curDb != null)
            {
                if (stateIndex >= 0)
                {
                    if (!string.IsNullOrEmpty(m_curDb.skillEffectTime))
                    {
                        string[] timeArray = SkillSystem.GetTimeArrayByString(m_curDb.skillEffectTime);
                        if (stateIndex < timeArray.Length)
                        {
                            uint time = 1000;
                            if (uint.TryParse(timeArray[stateIndex], out time))
                            {
                                m_uEffectLen = time;
                            }
                        }
                    }
                }
            }
            //  m_bRmove = false;

            IEffect ef = GetEffectByID(m_uEffectID);

            if (ef != null)
            {
                Transform trans = ef.GetNodeTransForm();
                if (trans == null)
                {
                    return;
                }
                m_placeHandle = trans.gameObject.GetComponent <PlaceFxHandle>();
                if (m_placeHandle == null)
                {
                    m_placeHandle = trans.gameObject.AddComponent <PlaceFxHandle>();
                }
            }
            m_placeHandle.m_attacker  = attacker;
            m_placeHandle.m_len       = m_uEffectLen;
            m_placeHandle.m_effectid  = m_uEffectID;
            m_placeHandle.m_placeNode = this;
            m_placeHandle.InitPlaceFx();
        }
Esempio n. 2
0
        public override void Play(ISkillAttacker attacker, SkillEffect se)
        {
            m_ef = se;
            GameObject go = attacker.GetTargetGameObject();

            if (go == null)
            {
                return;
            }

            FollowFxNodeProp prop = m_NodeProp as FollowFxNodeProp;

            if (prop == null)
            {
                return;
            }

            skill_id    = se.CurSkillID;
            m_uDamageID = attacker.GetDamageID();
            Transform attacker_node = attacker.GetRoot();

            if (attacker_node == null)
            {
                return;
            }
            //GameObject fxObj = SkillEffectHelper.Instance.GetFollowGameObject();
            //if (fxObj == null)
            //{
            //    Engine.Utility.Log.Error("============================fxobj is null");
            //    return;
            //}

            //fxObj.transform.parent = SkillEffectManager.Helper.PlaceFxRoot;
            //EffectUtil.ResetLocalTransform(fxObj.transform);

            //fxObj.transform.localEulerAngles = attacker_node.eulerAngles;
            //fxObj.transform.position = attacker_node.position;
            //fxObj.transform.Translate(prop.offset_pos);



            int level = 0;

            if (attacker != null)
            {
                if (attacker.GetSkillPart() != null)
                {
                    level = attacker.GetSkillPart().FxLevel;
                }
            }

            uint    effectid = helper.ReqPlayFx(prop.fx_name, helper.PlaceFxRoot, Vector3.zero, Vector3.one, level);
            IEffect ef       = GetEffectByID(effectid);

            if (ef != null)
            {
                if (ef.GetNodeTransForm() == null)
                {
                    return;
                }
                GameObject fxObj = ef.GetNodeTransForm().gameObject;
                if (fxObj == null)
                {
                    return;
                }
                fxObj.transform.localEulerAngles = attacker_node.eulerAngles;
                fxObj.transform.position         = attacker_node.position;
                fxObj.transform.Translate(prop.offset_pos);
                m_Handler = fxObj.GetComponent <FollowFxHandle>();
                if (m_Handler == null)
                {
                    m_Handler = fxObj.AddComponent <FollowFxHandle>();
                }
                m_Handler.m_attacker    = attacker;
                m_Handler.m_speed       = prop.speed;
                m_Handler.targetHitNode = prop.target_hitnode;
                m_Handler.m_acce        = prop.acce;
                m_Handler.m_len         = prop.len;
                m_Handler.m_hitIndex    = hit_index;
                m_Handler.m_hitNode     = this;
                m_Handler.m_effectid    = effectid;
                m_Handler.InitFollowFx();
            }
            //  fxObj.name = m_Handler.m_effectid.ToString();
        }