private void InitBulletEffect() { GameObject effect = Instantiate(BulletEffect); effect.transform.position = transform.position; DelayDestroy delayDestroy = effect.AddComponent <DelayDestroy>(); delayDestroy.SetLiveTime(2.0f); }
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); } }
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); }
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); } }
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; } } }