Separated farming controls from vesna behvaiour and adjusted the setup
This commit is contained in:
@@ -2,13 +2,15 @@ using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class FarmingControls : Node3D
|
||||
{
|
||||
[Export] private Sprite3D _hoeSprite;
|
||||
[Export] private PackedScene _fieldPrefab;
|
||||
[Export] private Node _fieldParent;
|
||||
[Export] private Node3D _movingPlayer;
|
||||
|
||||
public Node FieldParent;
|
||||
|
||||
private bool _hoeInHand = false;
|
||||
public void ActivateHoe(bool activate)
|
||||
{
|
||||
@@ -26,7 +28,7 @@ public partial class FarmingControls : Node3D
|
||||
|
||||
private void MakeField()
|
||||
{
|
||||
if(_fieldParent == null || _fieldPrefab == null)
|
||||
if(FieldParent == null || _fieldPrefab == null)
|
||||
return;
|
||||
|
||||
Node fieldInstance = _fieldPrefab.Instantiate();
|
||||
@@ -36,7 +38,7 @@ public partial class FarmingControls : Node3D
|
||||
field3d.Position = _movingPlayer.GlobalPosition;
|
||||
}
|
||||
|
||||
_fieldParent.AddChild(fieldInstance);
|
||||
FieldParent.AddChild(fieldInstance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user