mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 02:55:55 +00:00
Ability for enemies to shoot when controlled
This commit is contained in:
parent
dfd9abe91b
commit
2d6bcc5f00
10 changed files with 93 additions and 34 deletions
|
|
@ -67,7 +67,7 @@ public partial class Weapon : Node2D
|
|||
}
|
||||
}
|
||||
|
||||
public void Shoot()
|
||||
public void Shoot(BulletOwner? ownerOverride = null)
|
||||
{
|
||||
// Waiting on reload or Rate of Fire cooldown?
|
||||
if (!_cooldownTimer.IsStopped())
|
||||
|
|
@ -106,8 +106,14 @@ public partial class Weapon : Node2D
|
|||
GD.PrintErr("Bullet is null, not shooting");
|
||||
return;
|
||||
};
|
||||
|
||||
var bulletData = WeaponData.MakeBullet(_muzzle.GlobalPosition);
|
||||
if (ownerOverride.HasValue)
|
||||
{
|
||||
bulletData.Owner = ownerOverride.Value;
|
||||
}
|
||||
|
||||
bullet.Initialize(WeaponData.MakeBullet(_muzzle.GlobalPosition), _gameManager);
|
||||
bullet.Initialize(bulletData, _gameManager);
|
||||
|
||||
//bullet.SetDirection(ShootDirection);
|
||||
bullet.SetDirection(spreadDirection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue