Exemplo n.º 1
0
 // Update is called once per frame
 void LateUpdate()
 {
     if (shoot)
     {
         if (spread)
         {
             Spread();
         }
         else
         {
             if (pm.Flipped())
             {
                 currentBullet.b_Name = "PlayerBullet";
                 gunBarrel.position   = new Vector3(gunBarrel.position.x - 20.0f, gunBarrel.position.y, gunBarrel.position.z);
                 Bullet bullet = Instantiate(currentBullet, gunBarrel.position, Quaternion.identity);
                 bullet.speed = speed * pm.AimDirection();
                 Debug.Log(speed * pm.AimDirection());
             }
             else
             {
                 currentBullet.b_Name = "PlayerBullet";
                 Bullet bullet = Instantiate(currentBullet, gunBarrel.position, Quaternion.identity);
                 bullet.speed = speed * pm.AimDirection();
                 Debug.Log(speed * pm.AimDirection());
             }
         }
         FindObjectOfType <AudioManager>().Play("Shoot");
     }
 }