Initial commit

This commit is contained in:
Фёдор Веселов 2024-09-08 00:45:50 +05:00
commit c266d22f58
85 changed files with 1649 additions and 0 deletions

View file

@ -0,0 +1,31 @@
using Godot;
// Shoot component of some plants
public partial class Shooter : Node2D
{
[Export] private PackedScene _projectile;
[Export] private Timer _timer;
private RuntimePlantData _plantData;
public override void _Ready()
{
_plantData = GetParent<RuntimePlantData>();
}
public void Shoot()
{
if (_timer.TimeLeft > 0) return;
_timer.Start();
var instance = _projectile.Instantiate<Node2D>();
LevelController.Instance.Pools.Projectiles.AddChild(instance);
instance.GlobalTransform = GlobalTransform;
if (instance is IProjectile projectile)
{
projectile.Line = _plantData.Line;
}
}
}