24 lines
510 B
C#
24 lines
510 B
C#
namespace Dancer;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
public sealed partial class Rain : Sprite2D
|
|
{
|
|
[Export] private Vector2 Movement { get; set; } = new(0, 10);
|
|
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
public void OnReady()
|
|
{
|
|
SetProcess(true);
|
|
}
|
|
|
|
public void OnProcess(double delta)
|
|
{
|
|
var position = Position;
|
|
position += Movement * (float)delta;
|
|
var textureSize = Texture.GetSize();
|
|
position = position.PosMod(textureSize);
|
|
Position = position;
|
|
}
|
|
}
|
|
|