Beispiel #1
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);
         * }
         * }*/
    }