Threepeater added and line system removed
This commit is contained in:
parent
8fdc2a3ed9
commit
b5d2466be4
16 changed files with 131 additions and 209 deletions
|
|
@ -6,10 +6,10 @@ namespace Newlon.Components.Plants;
|
|||
// Shoot component of some plants
|
||||
public partial class Shooter : Node2D
|
||||
{
|
||||
[Export] private PackedScene _projectile;
|
||||
[Export] private Timer _timer;
|
||||
[Export] protected PackedScene _projectile;
|
||||
[Export] protected Timer _timer;
|
||||
|
||||
private RuntimePlantData _plantData;
|
||||
protected RuntimePlantData _plantData;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -22,13 +22,13 @@ public partial class Shooter : Node2D
|
|||
if (_timer.TimeLeft > 0) return;
|
||||
|
||||
_timer.Start();
|
||||
SpawnProjectile();
|
||||
}
|
||||
|
||||
public virtual void SpawnProjectile()
|
||||
{
|
||||
var instance = _projectile.Instantiate<Node2D>();
|
||||
PoolContainer.Instance.Projectiles.AddChild(instance);
|
||||
instance.GlobalTransform = GlobalTransform;
|
||||
|
||||
if (instance is IProjectile projectile)
|
||||
{
|
||||
projectile.Line = _plantData.Line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue