Threepeater added and line system removed
This commit is contained in:
parent
8fdc2a3ed9
commit
b5d2466be4
16 changed files with 131 additions and 209 deletions
26
scripts/components/plants/ThreepeaterShooter.cs
Normal file
26
scripts/components/plants/ThreepeaterShooter.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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 ((int)GetParent<Node2D>().GlobalPosition.Y/Utility.TileHeight+i < 0 || (int)GetParent<Node2D>().GlobalPosition.Y/Utility.TileHeight+i > Utility.LineCount+1)
|
||||
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*Utility.TileHeight,0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue