Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (m_bpause)
        {
            return;
        }
        m_TimeCount += Time.deltaTime;
        if (m_TimeCount < m_Duration)
        {
            Vector3 pos = Vector3.Lerp(m_Start, m_Destination, m_TimeCount / m_Duration);
            transform.localPosition = pos;

            List <Life> l = new List <Life>();
            CM.SearchLifeMListInBoat(ref l, LifeMType.SOLDIER, m_camp);
            List <Life> hit = new List <Life>();
            for (int i = 0; i < l.Count; i++)
            {
                if (m_layer == l[i].GetMapPos().Layer)
                {
                    if (transform.localPosition.x > (l[i].m_thisT.localPosition.x - 0.25f) && transform.localPosition.x > (l[i].m_thisT.localPosition.x + 0.25f))
                    {
                        if (!l[i].m_isDead && !m_hitRole.Contains(l[i]))
                        {
                            m_hitRole.Add(l[i]);
                            hit.Add(l[i]);
                            if (m_info.m_hiteffect != 0)
                            {
                                pos   = l[i].m_thisT.position;
                                pos.z = -1.5f;
                                GameObjectActionExcute     gae  = EffectM.LoadEffect(EffectM.sPath, m_info.m_hiteffect.ToString(), pos, BattleEnvironmentM.GetLifeMBornNode(true));
                                GameObjectActionEffectInit init = new GameObjectActionEffectInit();
                                init.SetEffectMirror(m_dir);
                                gae.AddAction(init);
                                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f);
                                gae.AddAction(ndEffect);
                            }
                        }
                    }
                }

                //SkillEffects._instance.LoadEffect("effect/prefab/", m_info.m_hiteffect.ToString(),transform.position,1.5f);
            }

            m_fun(m_skillinfo, 1, hit);
        }
        else
        {
            GameObject.Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (m_bpause)
        {
            return;
        }
        m_TimeCount += Time.deltaTime;
        if (m_type == BulletType.Missile)
        {
            Missile m   = GetComponent <Missile>();
            Vector3 pos = transform.localPosition;
            if (m_TimeCount < m_outtime)
            {
                pos = Vector3.Lerp(m_Start, m_fadeoutpos, m_TimeCount / m_outtime);
                transform.localPosition = pos;
                float Angles = NdUtil.V2toAngle(m_Start, m_fadeoutpos, Vector3.right);
                m.SetAngle(-Angles);
            }
            else if (m_TimeCount >= m_Duration)
            {
                //effect = SkillEffects._instance.LoadEffect("effect/prefab/", "1002061",transform.position,1.5f);
                GameObjectActionExcute       gae      = EffectM.LoadEffect(EffectM.sPath, "1002061", transform.position, BattleEnvironmentM.GetLifeMBornNode(true));
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f);
                gae.AddAction(ndEffect);
                effect = gae.gameObject;
                SoundPlay.Stop("missile_launch", false);
                SoundPlay.Play("missile_explosion", false, false);
                m_fun(m_skillinfo, 1);
                GameObject.Destroy(gameObject);
            }
            else
            {
                pos = myBezier.GetPointAtTime((m_TimeCount - m_outtime) / (m_Duration - m_outtime));
                float Angles = NdUtil.V2toAngle(pos, myBezier.GetPointAtTime((m_TimeCount - m_outtime) / (m_Duration - m_outtime) + 0.01f), Vector3.right);
                m.SetAngle(-Angles);
                transform.localPosition = pos;
            }
        }
        else
        {
            if (m_TimeCount < m_Duration)
            {
                Vector3 pos = transform.localPosition;
                //pos.x = Mathf.Lerp(m_Start.x,m_Destination.x,m_TimeCount/ m_Duration);
                pos = myBezier.GetPointAtTime(m_TimeCount / m_Duration);
                transform.localPosition = pos;
            }
            else if (m_TimeCount >= m_Duration)
            {
                if (m_skillinfo.m_type == 1005)
                {
                    if (m_TimeCount <= m_Duration + 0.5f)
                    {
                        Vector3 pos = transform.localPosition;
                        pos = myBezier1.GetPointAtTime((m_TimeCount - m_Duration) / 0.5f);
                        transform.localPosition = pos;
                    }
                    else if (m_TimeCount < m_Duration + 1f)
                    {
                        Vector3 pos = transform.localPosition;
                        pos = myBezier2.GetPointAtTime((m_TimeCount - m_Duration - 0.5f) / 0.5f);
                        transform.localPosition = pos;
                    }
                }
                if (m_TimeCount >= m_Duration + m_skillinfo.m_intone_speed * 0.001f)
                {
                    //Debug.Log(m_type   +"," + transform.position);
                    transform.localPosition = m_Destination;
                    if (m_skillinfo.m_type != 1028)
                    {
                        m_fun(m_skillinfo, 1);
                    }

                    //SkillEffects._instance.LoadEffect("effect/prefab/", m_info.m_hiteffect.ToString(),transform.position,1.5f);
                    if (m_info.m_hiteffect != 0)
                    {
                        Vector3 pos = transform.position;
                        pos.z = -1.5f;
                        GameObjectActionExcute     gae  = EffectM.LoadEffect(EffectM.sPath, m_info.m_hiteffect.ToString(), pos, BattleEnvironmentM.GetLifeMBornNode(true));
                        GameObjectActionEffectInit init = new GameObjectActionEffectInit();
                        init.SetEffectMirror(m_dir);
                        gae.AddAction(init);
                        GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f);
                        gae.AddAction(ndEffect);
                    }

                    if (m_info.m_hitaudio != "")
                    {
                        SoundPlay.Play(m_info.m_hitaudio, false, false);
                    }
                    GameObject.Destroy(gameObject);
                }
            }
        }

        /*else if (m_type == BulletType.Bullet )
         * {
         *      Vector3 pos = transform.localPosition;
         *      pos.x = Mathf.Lerp(m_Start.x,m_Destination.x,m_TimeCount/ m_Duration);
         *      transform.localPosition = pos;
         *      if (m_TimeCount>= m_Duration)
         *      {
         *              m_fun(m_skillinfo,1);
         *              GameObject.Destroy(gameObject);
         *      }
         * }
         * else if (m_type == BulletType.Grenade)
         * {
         *      Vector3 pos = transform.localPosition;
         *      //pos.x = Mathf.Lerp(m_Start.x,m_Destination.x,m_TimeCount/ m_Duration);
         *      pos = myBezier.GetPointAtTime(m_TimeCount/m_Duration);
         *      transform.localPosition = pos;
         *      if (m_TimeCount>= m_Duration)
         *      {
         *              //Debug.Log(m_type   +"," + transform.position);
         *              transform.localPosition = m_Destination;
         *              m_fun(m_skillinfo,1);
         *              SkillEffects._instance.LoadEffect("effect/prefab/", "1002081",transform.position,1.5f);
         * SoundPlay.Play("grenade_explosion",false ,false);
         * GameObject.Destroy(gameObject);
         *      }
         * }
         * else if (m_type == BulletType.Snowball)
         * {
         *      Vector3 pos = transform.localPosition;
         *      pos = myBezier.GetPointAtTime(m_TimeCount/m_Duration);
         *      transform.localPosition = pos;
         *      if (m_TimeCount>= m_Duration)
         *      {
         *              //Debug.Log(m_type +"," +transform.position);
         *              transform.localPosition = m_Destination;
         *              m_fun(m_skillinfo,1);
         *              SkillEffects._instance.LoadEffect("effect/prefab/", "1002101",transform.position,1.5f);
         * GameObject.Destroy(gameObject);
         *      }
         * }
         * else if (m_type == BulletType.Poison)
         * {
         *      Vector3 pos = transform.localPosition;
         *      pos = myBezier.GetPointAtTime(m_TimeCount/m_Duration);
         *      transform.localPosition = pos;
         *      //Debug.Log(m_Start + ",  " + m_Destination + ",  " + pos  + ", " + m_TimeCount + "," + m_Duration);
         *      if (m_TimeCount>= m_Duration)
         *      {
         *              //Debug.Log(m_type +"," +transform.position);
         *              transform.localPosition = m_Destination;
         *              m_fun(m_skillinfo,1);
         *              SkillEffects._instance.LoadEffect("effect/prefab/", "1052031",transform.position,1f);
         *              GameObject.Destroy(gameObject);
         *              SoundPlay.Play("skill_money_dy",false ,false);
         *      }
         * }
         * else if (m_type == BulletType.ling)
         * {
         *      Vector3 pos = transform.localPosition;
         *      pos = myBezier.GetPointAtTime(m_TimeCount/m_Duration);
         *      transform.localPosition = pos;
         *      //Debug.Log(m_Start + ",  " + m_Destination + ",  " + pos  + ", " + m_TimeCount + "," + m_Duration);
         *      if (m_TimeCount>= m_Duration)
         *      {
         *              //Debug.Log(m_type +"," +transform.position);
         *              transform.localPosition = m_Destination;
         *              m_fun(m_skillinfo,1);
         *              //SkillEffects._instance.LoadEffect("effect/prefab/", "1052031",transform.position,1f);
         *              GameObject.Destroy(gameObject);
         *      }
         * }
         * else if (m_type == BulletType.bomb1028)
         * {
         * Vector3 pos = transform.localPosition;
         * pos.x = Mathf.Lerp(m_Start.x, m_Destination.x, m_TimeCount / m_Duration);
         * transform.localPosition = pos;
         * if (m_TimeCount >= m_Duration)
         * {
         * //m_fun(m_skillinfo, 1);
         * SkillEffects._instance.LoadEffect("effect/prefab/", "1003031", transform.position, 1.3f);
         * GameObject.Destroy(gameObject);
         * }
         * }*/
    }
Exemplo n.º 3
0
    /// <summary>
    /// 挂载角色状态特效
    /// </summary>
    /// <param name="EffectPos">特效挂载位置</param>
    /// <param name="time">特效持续时间</param>
    /// <param name="EffectID">特效ID ,转换成对应的特效名称</param>
    /// <returns>返回搜索列表list</returns>
    public GameObject AddStatusEffect(int EffectPos, float time, int EffectID, WalkDir dir)
    {
        if (EffectID == 1101031)        //临时
        {
            GameObject posgo = ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectPos);
            Vector3    pos   = posgo.transform.position;
            pos.z = -1f;
            string temp;
            if (dir == WalkDir.WALKLEFT)
            {
                temp = "1101031_0";
            }
            else
            {
                temp = "1101031_1";
            }
            GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", temp, pos, posgo.transform);
            if (gae != null)
            {
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(8.5f);
                gae.AddAction(ndEffect);
            }
            return(null);
        }
        if (EffectID == 0)
        {
            return(null);
        }
        if (EffectPos == 1)
        {
            GameObject posgo = ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectTopPos);
            Vector3    pos   = posgo.transform.position;
            pos.z = -1f;
            GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", EffectID.ToString(), pos, posgo.transform);
            if (gae != null)
            {
                GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit();
                effectinit.SetEffectMirror(dir);
                gae.AddAction(effectinit);
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(time);
                gae.AddAction(ndEffect);
                return(gae.gameObject);
            }
            return(null);
        }
        else if (EffectPos == 2)
        {
            GameObject posgo = ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectPos);
            Vector3    pos   = posgo.transform.position;
            pos.z = -1f;
            GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", EffectID.ToString(), pos, posgo.transform);
            if (gae != null)
            {
                GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit();
                effectinit.SetEffectMirror(dir);
                gae.AddAction(effectinit);
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(time);
                gae.AddAction(ndEffect);
                return(gae.gameObject);
            }
            return(null);
        }
        else if (EffectPos == 3)
        {
            GameObject posgo = ProPerty.HelpPoint.GetVauleByKey(HelpPointName.EffectBottomPos);
            Vector3    pos   = posgo.transform.position;
            pos.z += -2f;
            GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", EffectID.ToString(), pos, posgo.transform);
            if (gae != null)
            {
                GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit();
                effectinit.SetEffectMirror(dir);
                gae.AddAction(effectinit);
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(time);
                gae.AddAction(ndEffect);
                return(gae.gameObject);
            }
            return(null);
        }
        else if (EffectPos == 4)
        {
            GameObject             posgo = ProPerty.HelpPoint.GetVauleByKey(HelpPointName.LeyePos);
            Vector3                pos   = posgo.transform.position;
            GameObjectActionExcute gae   = EffectM.LoadEffect("effect/prefab/", EffectID.ToString(), pos, posgo.transform);
            if (gae != null)
            {
                GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit();
                effectinit.SetEffectMirror(dir);
                gae.AddAction(effectinit);
                GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(time);
                gae.AddAction(ndEffect);
                return(gae.gameObject);
            }
            return(null);
        }

        return(null);
    }