Initial Farming setup complete
This commit is contained in:
@@ -7,15 +7,40 @@ public partial class FieldBehaviour2D : Sprite2D
|
||||
{
|
||||
[Export] private Texture2D Tilled;
|
||||
[Export] private Texture2D Watered;
|
||||
[Export] public FieldState FieldState = FieldState.Empty;
|
||||
[Export] public FieldState FieldState = FieldState.Tilled;
|
||||
|
||||
public Vector2 FieldPosition;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Texture = Tilled;
|
||||
UpdateFieldState(FieldState);
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
public void UpdateFieldState(FieldState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case FieldState.Empty:
|
||||
FieldState = FieldState.Empty;
|
||||
break;
|
||||
case FieldState.Tilled:
|
||||
FieldState = FieldState.Tilled;
|
||||
Texture = Tilled;
|
||||
break;
|
||||
case FieldState.Watered:
|
||||
FieldState = FieldState.Watered;
|
||||
Texture = Watered;
|
||||
break;
|
||||
case FieldState.Planted:
|
||||
FieldState = FieldState.Planted;
|
||||
break;
|
||||
default:
|
||||
FieldState = FieldState.NotFound;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Water()
|
||||
{
|
||||
@@ -24,7 +49,7 @@ public partial class FieldBehaviour2D : Sprite2D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the player enters the field'S interaction area and presses <E>.
|
||||
/// Called when the player enters the field's interaction area and presses <E>.
|
||||
/// </summary>
|
||||
public void Farm()
|
||||
{
|
||||
@@ -34,7 +59,7 @@ public partial class FieldBehaviour2D : Sprite2D
|
||||
Texture = Tilled;
|
||||
FieldState = FieldState.Tilled;
|
||||
break;
|
||||
case FieldState.Tilled:
|
||||
case FieldState.Watered:
|
||||
FieldState = FieldState.Planted;
|
||||
break;
|
||||
case FieldState.Planted:
|
||||
@@ -42,6 +67,5 @@ public partial class FieldBehaviour2D : Sprite2D
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user