complete refactor

This commit is contained in:
Rendo 2025-07-25 18:48:49 +05:00
commit de2e8b1e50
71 changed files with 212 additions and 137 deletions

View file

@ -1,5 +1,7 @@
using Godot;
namespace Newlon.Components.Droppables;
public partial class DropMover : Node
{
public float ySpeed = -200.0f;
@ -16,7 +18,7 @@ public partial class DropMover : Node
stop_y = ((parent.GlobalPosition / FieldParams.Tile).Ceil() * FieldParams.Tile).Y;
gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity");
velocity = new Vector2((GD.Randf()-0.5f)*xSpeed,ySpeed);
velocity = new Vector2((GD.Randf() - 0.5f) * xSpeed, ySpeed);
}
public override void _Process(double delta)
{
@ -25,6 +27,6 @@ public partial class DropMover : Node
velocity += Vector2.Down * gravity * (float)delta;
parent.GlobalPosition += velocity * (float)delta;
}
}
}

View file

@ -1,5 +1,6 @@
using Godot;
namespace Newlon.Components.Droppables;
[GlobalClass]
public partial class DroppableItem : Area2D

View file

@ -1,5 +1,7 @@
using Godot;
using Newlon;
using Newlon.Resources;
namespace Newlon.Components.Droppables;
public partial class DroppableSeedpacket : DroppableItem
{
@ -11,10 +13,10 @@ public partial class DroppableSeedpacket : DroppableItem
{
_cost.Text = plant.Cost.ToString();
_icon.Texture = plant.Preview;
if (plant.customFrame != null)
if (plant.CustomFrame != null)
{
_packet.Texture = plant.customFrame.frame;
_cost.LabelSettings = plant.customFrame.font;
_packet.Texture = plant.CustomFrame.frame;
_cost.LabelSettings = plant.CustomFrame.font;
}
}
}