void OnBulletVsPlayerBaseSolidCollisionOccurred (Entities.Bullet bullet, Entities.PlayerBase playerBase) { if(bullet.TeamIndex == 1) { playerBase.TakeDamage(bullet.DamageToDeal); bullet.PlayerDestroyVfx(); bullet.TryExplode(); bullet.Destroy(); } }
private void ShootingActivity() { if (InputManager.Mouse.ButtonReleased(Mouse.MouseButtons.LeftButton)) { Entities.Bullet bullet = new Entities.Bullet(); bullet.Position = GunRectangle.Position; bullet.RotationZ = HandSprite.RotationZ; bullet.rightDirection = HandSprite.FlipHorizontal; Factories.BulletFactory.ScreenListReference.Add(bullet); } }
void OnBulletListVsShipListCollisionOccurred(Entities.Bullet bullet, Entities.Ship ship) { if (bullet.TeamIndex != ship.TeamIndex) { var effect = ShipImpactFactory.CreateNew(); effect.EmitEffectParticles(bullet.Position.ToVector2(), -bullet.Velocity.Normalized().ToVector2()); bullet.CollideAgainstBounce(ship, .05f, 1, 1); bullet.Destroy(); ship.TakeDamage(Bullet.DamageToDeal, bullet.Owner); } }
private void KeyHold() { foreach (Key input in GetDownKeys()) { if (input == Key.Up) { player.Forward(); } else if (input == Key.Down) { player.Backward(); } if (input == Key.Left) { player.Left(); } else if (input == Key.Right) { player.Right(); } if ((input == Key.Space || input == Key.LeftCtrl || input == Key.RightCtrl) && timer == 0) { timer = 5; shoot.play(); Entities.Bullet create = new Entities.Bullet(player.GetAngle(), player.GetPosition(), 10); Bullets.Add(create); } } timer--; if (timer < 0) { timer = 0; } }