Aqua state
This commit is contained in:
parent
8708540770
commit
31ba172123
6 changed files with 48 additions and 36 deletions
|
|
@ -5,7 +5,7 @@ namespace Newlon.Components.Plants;
|
|||
public partial class DragAction : Node
|
||||
{
|
||||
[Signal] public delegate void DragBeginEventHandler();
|
||||
[Signal] public delegate void DragEndEventHandler();
|
||||
[Signal] public delegate void DragEndEventHandler(bool aborted);
|
||||
private bool dragging = false;
|
||||
private bool toggle = false;
|
||||
private bool can_end = false;
|
||||
|
|
@ -38,9 +38,14 @@ public partial class DragAction : Node
|
|||
if (dragging && can_end && (toggle == false && @event.IsActionReleased("primary_action") || (toggle == true && @event.IsActionPressed("primary_action"))))
|
||||
{
|
||||
dragging = false;
|
||||
EmitSignal(SignalName.DragEnd);
|
||||
EmitSignal(SignalName.DragEnd,false);
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
if (dragging && @event.IsActionPressed("cancel_action"))
|
||||
{
|
||||
dragging = false;
|
||||
EmitSignal(SignalName.DragEnd,true);
|
||||
}
|
||||
}
|
||||
public void OnToggleTimeout()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ public partial class SnipachBehaviour : BaseBehaviour
|
|||
attackBox.Visible = dragging;
|
||||
}
|
||||
|
||||
public void OnDragEnd()
|
||||
public void OnDragEnd(bool aborted)
|
||||
{
|
||||
if (dragging == false) return;
|
||||
attackBox.Attack();
|
||||
dragging = false;
|
||||
attackBox.Visible = dragging;
|
||||
if (aborted) return;
|
||||
attackBox.Attack();
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +32,14 @@ public partial class SnipachBehaviour : BaseBehaviour
|
|||
{
|
||||
attackBox.GlobalPosition = (Cursor.GetCursorPosition() / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14);
|
||||
}
|
||||
if (timer.TimeLeft > 0)
|
||||
{
|
||||
GetParent<Node2D>().Modulate = Colors.DeepSkyBlue;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetParent<Node2D>().Modulate = Colors.White;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public partial class ShovelButton : TextureButton
|
|||
hoveredEntity = null;
|
||||
ButtonPressed = false;
|
||||
}
|
||||
if (@event.IsActionPressed("cancel_plant") && ButtonPressed)
|
||||
if (@event.IsActionPressed("cancel_action") && ButtonPressed)
|
||||
{
|
||||
hoveredEntity?.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public partial class PlantField : Node2D
|
|||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed("cancel_plant") && _slot != null)
|
||||
if (@event.IsActionPressed("cancel_action") && _slot != null)
|
||||
{
|
||||
ResetPlant();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue