public void Shootchild(BulletManager.BulletType type, Vector2 position) { Bullet b = BulletManager.GetBullet(type); if (b != null) { Vector2 direction = new Vector2(0, 10); b.Shoot(position, direction); } }
public override Bullet Shoot(BulletManager.BulletType type, float speedPercentage = 1.0f) { Bullet b = BulletManager.GetBullet(type); if (b != null) { float bulletOffsetX = b.Width / 2; Vector2 direction = new Vector2((float)Math.Cos(turret.Rotation), (float)Math.Sin(turret.Rotation)); b.Shoot(turret.position + direction * (turretLength + bulletOffsetX), direction * speedPercentage); CameraManager.SetTarget(b); } return(b); }
public override Bullet Shoot(BulletManager.BulletType type, float speedPercentage = 1.0f) { Bullet b = BulletManager.GetBullet(type); if (b != null) { float bulletOffsetX = b.Width / 2; Vector2 direction = new Vector2((float)Math.Cos(turret.Rotation), (float)Math.Sin(turret.Rotation)); //AudioSource t = ((PlayScene)Game.CurrentScene).GetSource; //t.Play(AudioManager.GetAudio("shot")); //t.Volume = 0.5f; AudioManager.SetAudio("shot", speedPercentage); b.Shoot(turret.position + direction * (turretLength + bulletOffsetX), direction * speedPercentage); CameraManager.SetTarget(b); } return(b); }