Esempio n. 1
0
 private void FireBullet()
 {
     if (currentBullet == null)
     {
         audioSource.PlayOneShot(fireClip);
         currentBullet = Resources.Load("Prefabs/PlayerBullet") as GameObject;
         Vector2 bulletDirection = Fire();
         // Debug.Log("Bullet Direction:" + bulletDirection);
         Assert.IsNotNull(currentBullet);
         currentBullet.transform.position = gameObject.transform.position;
         currentBullet   = Instantiate(currentBullet);
         bulletDirection = -bulletDirection;
         PlayerBullet playerBullet = currentBullet.GetComponent <PlayerBullet>();
         playerBullet.Fire(bulletDirection);
     }
 }