droppable items and win
This commit is contained in:
parent
0f6445d677
commit
5bdbfa4d82
47 changed files with 820 additions and 85 deletions
1
scripts/droppable-items/DropMover.cs.uid
Normal file
1
scripts/droppable-items/DropMover.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b2j41pq6cmpgm
|
||||
17
scripts/droppable-items/DroppableItem.cs
Normal file
17
scripts/droppable-items/DroppableItem.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using Godot;
|
||||
|
||||
|
||||
[GlobalClass]
|
||||
public abstract partial class DroppableItem : Area2D
|
||||
{
|
||||
[Signal] public delegate void PickedUpEventHandler();
|
||||
public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx)
|
||||
{
|
||||
if (@event.IsActionPressed("primary_action"))
|
||||
{
|
||||
PickUp();
|
||||
}
|
||||
}
|
||||
public abstract void PickUp();
|
||||
|
||||
}
|
||||
1
scripts/droppable-items/DroppableItem.cs.uid
Normal file
1
scripts/droppable-items/DroppableItem.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cwf2y3pxi6psc
|
||||
25
scripts/droppable-items/DroppableSeedpacket.cs
Normal file
25
scripts/droppable-items/DroppableSeedpacket.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
|
||||
public partial class DroppableSeedpacket : DroppableItem
|
||||
{
|
||||
public PlantResource plant;
|
||||
[Export] private Label _cost;
|
||||
[Export] private TextureRect _icon;
|
||||
[Export] private TextureRect _packet;
|
||||
public override void _Ready()
|
||||
{
|
||||
_cost.Text = plant.Cost.ToString();
|
||||
_icon.Texture = plant.Preview;
|
||||
if (plant.customFrame != null)
|
||||
{
|
||||
_packet.Texture = plant.customFrame.frame;
|
||||
_cost.LabelSettings = plant.customFrame.font;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PickUp()
|
||||
{
|
||||
EmitSignal(SignalName.PickedUp);
|
||||
}
|
||||
}
|
||||
1
scripts/droppable-items/DroppableSeedpacket.cs.uid
Normal file
1
scripts/droppable-items/DroppableSeedpacket.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://gymo10tjruj2
|
||||
Loading…
Add table
Add a link
Reference in a new issue