예제 #1
0
 private void Fire()
 {
     if (Time.realtimeSinceStartup - LastTimeFire > TimeToFire)
     {
         GameObject bullet = Instantiate(BulletPrefab, GunTransform.position, GunTransform.rotation);
         bullet.GetComponent <Rigidbody2D>().velocity = GunTransform.right * ForcebulletVelocity;
         Destroy(bullet, TimeToDestroyBullet);
         LastTimeFire = Time.realtimeSinceStartup;
         SoundsManager.PlayShootSound();
     }
 }