mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 01:25:55 +00:00
Gamemanager in bullet
This commit is contained in:
parent
a9b2c8c873
commit
1ee8f085e8
6 changed files with 92 additions and 13 deletions
|
|
@ -27,10 +27,14 @@ public partial class Bullet : Area2D
|
|||
|
||||
private List<ModifierWrapper> _modifiers = new();
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo)
|
||||
private GameManager _gameManager;
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo, GameManager gameManager)
|
||||
{
|
||||
_bulletInfo = bulletInfo;
|
||||
|
||||
_gameManager = gameManager;
|
||||
|
||||
// Ugly hack to make instances unique
|
||||
_modifiers = _bulletInfo.TimeModifiers.Select(x => new ModifierWrapper()
|
||||
{
|
||||
|
|
@ -79,14 +83,11 @@ public partial class Bullet : Area2D
|
|||
//Rotation = radians;
|
||||
}
|
||||
|
||||
|
||||
private void FacePlayer()
|
||||
{
|
||||
// TODO: cache player
|
||||
var player = GetTree().GetFirstNodeInGroup("Player") as Node2D;
|
||||
if (player != null)
|
||||
if (_gameManager.Player != null)
|
||||
{
|
||||
_direction = (player.GlobalPosition - this.GlobalPosition).Normalized();
|
||||
_direction = (_gameManager.Player.GlobalPosition - this.GlobalPosition).Normalized();
|
||||
//LookAt(player.GlobalPosition);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue