Пример #1
0
        private void InitBulletEffect()
        {
            GameObject effect = Instantiate(BulletEffect);

            effect.transform.position = transform.position;
            DelayDestroy delayDestroy = effect.AddComponent <DelayDestroy>();

            delayDestroy.SetLiveTime(2.0f);
        }
Пример #2
0
 private void AddFireEffect()
 {
     if (m_CurTime >= m_DelayTime)
     {
         m_StartAct = false;
         GameObject fireEffect = Instantiate(m_FireEffectPrefab);
         fireEffect.transform.SetParent(FirePoint, false);
         DelayDestroy delayDestroy = fireEffect.AddComponent <DelayDestroy>();
         delayDestroy.SetLiveTime(0.2f);
     }
 }
Пример #3
0
        private void StartDamage()
        {
            InitBulletEffect();
            GetComponent <Collider2D>().enabled    = true;
            GetComponent <Rigidbody2D>().simulated = true;
            enabled = true;
            transform.Find("stone").gameObject.SetActive(false);
            DelayDestroy delay = gameObject.AddComponent <DelayDestroy>();

            delay.SetLiveTime(0.1f);
        }
Пример #4
0
 private void FireToMainPlayer()
 {
     if (m_CurTime >= m_DelayTime)
     {
         m_StartAct = false;
         GameObject rugbyBall = Instantiate(m_BulletPrefab);
         rugbyBall.GetComponent <DesertEagleBullet>().Init(1, FirePoint, 0, 0, 0);
         GameObject fireEffect = Instantiate(m_FireEffectPrefab);
         fireEffect.transform.SetParent(FirePoint, false);
         DelayDestroy delayDestroy = fireEffect.AddComponent <DelayDestroy>();
         delayDestroy.SetLiveTime(0.2f);
     }
 }
Пример #5
0
 private void FireToMainPlayer()
 {
     if (m_CurTime >= m_DelayTime)
     {
         m_StartAct = false;
         float dtAngleZ = -m_DtAngle * (FireCurve - 1) / 2;
         for (int i = 0; i < FireCurve; i++)
         {
             GameObject rugbyBall = Instantiate(m_BulletPrefab);
             rugbyBall.GetComponent <DesertEagleBullet>().Init(1, FirePoint, dtAngleZ, 0, 0);
             GameObject fireEffect = Instantiate(m_FireEffectPrefab);
             fireEffect.transform.SetParent(FirePoint, false);
             DelayDestroy delayDestroy = fireEffect.AddComponent <DelayDestroy>();
             delayDestroy.SetLiveTime(0.2f);
             dtAngleZ = dtAngleZ + m_DtAngle;
         }
     }
 }