Beispiel #1
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (m_IsInDelayDestroy)
            {
                return;
            }
            if (collision.gameObject.CompareTag(GameConstVal.MonsterTag))
            {
                Monster monster = collision.gameObject.GetComponent <Monster>();
                Global.gApp.gAudioSource.PlayOneShot(HittedEnemyClip);
                monster.OnHit_Vec(m_Damage, transform);
                AddHittedEffect(monster, true);

                if (m_ExplodeObj != null && monster.InDeath)
                {
                    var obj = Instantiate(m_ExplodeObj);
                    //Transform explodeTsf = transform.parent.Find("ExplodeCollision");
                    RocketExplode rocketExplode = obj.GetComponent <RocketExplode>();
                    if (rocketExplode != null)
                    {
                        rocketExplode.SetDamage(m_Damage);

                        obj.transform.position = monster.transform.position;
                        obj.transform.gameObject.SetActive(true);
                    }
                }
            }
        }
Beispiel #2
0
        public override void Init(double damage, Transform firePoint, float dtAngleZ, float offset, float atkRange = 0)
        {
            transform.parent.SetParent(Global.gApp.gBulletNode.transform, false);
            Transform explodeTsf = transform.parent.Find("ExplodeCollision");
            //explodeTsf.GetComponent<RocketExplode>().SetDamage(m_Damage);
            RocketExplode rocketExplode = explodeTsf.GetComponent <RocketExplode>();

            if (rocketExplode != null)
            {
                rocketExplode.SetDamage(m_Damage);
            }
            else
            {
                explodeTsf.GetComponent <RocketExplodeFireBuff>().SetDamage(m_Damage);
            }

            InitBulletPose(damage, firePoint, dtAngleZ, offset);
            InitBulletEffect(firePoint);
        }
Beispiel #3
0
        private void OnHitted()
        {
            m_IsInDelayDestroy = true;
            Transform explodeTsf = transform.parent.Find("ExplodeCollision");
            //explodeTsf.GetComponent<RocketExplode>().SetDamage(m_Damage);
            RocketExplode rocketExplode = explodeTsf.GetComponent <RocketExplode>();

            if (rocketExplode != null)
            {
                rocketExplode.SetDamage(m_Damage);
            }
            else
            {
                explodeTsf.GetComponent <RocketExplodeFireBuff>().SetDamage(m_Damage);
            }

            explodeTsf.position = transform.position;
            explodeTsf.gameObject.SetActive(true);
            gameObject.SetActive(false);
        }
 private bool AddExplodeBullet(Vector3 pos, bool forceAdd = false)
 {
     if (m_ExplodeTime > m_ExplodeDtTime || forceAdd)
     {
         m_ExplodeTime = 0;
         GameObject explodeBullet = Instantiate(m_ExplodeBullet);
         explodeBullet.transform.position = pos;
         RocketExplode rocketExplode = explodeBullet.GetComponentInChildren <RocketExplode>();
         if (rocketExplode != null)
         {
             rocketExplode.AddExplodeEffect(m_Damage);
         }
         else
         {
             explodeBullet.GetComponentInChildren <RocketExplodeFireBuff>().AddExplodeEffect(m_Damage);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }