Ejemplo n.º 1
0
        public override void _InputEvent(Object viewport, InputEvent @event, int shapeIdx)
        {
            if (dialogActive)
            {
                return;
            }

            if (@event.IsActionPressed("left_click"))
            {
                GetTree().SetInputAsHandled();
                if (GlobalPosition.DistanceTo(player.GlobalPosition) < 16)
                {
                    EmitSignal(nameof(SendTextToDialog), text);
                }
                else
                {
                    player.Set("targetX", new Vector2(GetGlobalMousePosition().x, 0));
                    player.Set("targetY", new Vector2(0, GetGlobalMousePosition().y));
                }
            }
        }