28 lines
747 B
C#
28 lines
747 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class SunSpawner : Node
|
|
{
|
|
[Export]
|
|
public int MinSun = 25;
|
|
[Export]
|
|
public int MaxSun = 25;
|
|
|
|
[Export]
|
|
private PackedScene SunScene;
|
|
|
|
public void Spawn()
|
|
{
|
|
float x = GD.Randf()*9*Utility.TileWidth;
|
|
uint y = GD.Randi() % 5;
|
|
|
|
var sun = SunScene.Instantiate<Sun>();
|
|
PoolContainer.Instance.Projectiles.AddChild(sun);
|
|
|
|
sun.GlobalPosition = new Vector2(Utility.LeftFieldBoundary.X + x, -90);
|
|
|
|
var moveTween = CreateTween();
|
|
moveTween.TweenProperty(sun,"global_position", new Vector2(Utility.LeftFieldBoundary.X + x,
|
|
Utility.LeftFieldBoundary.Y + Utility.TileHeight * y + Utility.TileHeight/2.0f),9-y);
|
|
}
|
|
}
|