26 lines
832 B
C#
26 lines
832 B
C#
using Godot;
|
|
using Newlon.Components.Level;
|
|
|
|
namespace Newlon.Components.Plants;
|
|
|
|
public partial class ThreepeaterShooter : Shooter
|
|
{
|
|
public override void SpawnProjectile()
|
|
{
|
|
for(int i = -1; i <= 1; i++)
|
|
{
|
|
if (GetParent<Node2D>().GlobalPosition.Y+i*FieldParams.TileHeight >= FieldParams.RightFieldBoundary.Y || GetParent<Node2D>().GlobalPosition.Y+i*FieldParams.TileHeight <= FieldParams.LeftFieldBoundary.Y)
|
|
continue;
|
|
|
|
var instance = _projectile.Instantiate<Node2D>();
|
|
PoolContainer.Instance.Projectiles.AddChild(instance);
|
|
instance.GlobalTransform = GlobalTransform;
|
|
|
|
if(i != 0)
|
|
{
|
|
var tween = CreateTween().SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Sine);
|
|
tween.TweenProperty(instance,"position:y",instance.Position.Y+i*FieldParams.TileHeight,0.5);
|
|
}
|
|
}
|
|
}
|
|
}
|