You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Babushka/scripts/CSharp/Common/Farming/FieldBehaviour.cs

60 lines
1.4 KiB

using System.Diagnostics;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming
{
public enum FieldState
{
Empty = 0,
Tilled = 1,
Planted = 2,
Watered = 3,
NotFound = 99
}
[GlobalClass]
public partial class FieldBehaviour : Sprite3D
{
[Export] private Texture2D Tilled;
[Export] private Texture2D Watered;
[Export] public FieldState FieldState = FieldState.Empty;
public Vector2 FieldPosition;
public override void _Ready()
{
Texture = Tilled;
base._Ready();
}
public void Water()
{
FieldState = FieldState.Watered;
Texture = Watered;
}
/// <summary>
/// Called when the player enters the field'S interaction area and presses <E>.
/// </summary>
public void Farm()
{
switch (FieldState)
{
case FieldState.Empty:
Texture = Tilled;
FieldState = FieldState.Tilled;
break;
case FieldState.Tilled:
FieldState = FieldState.Planted;
break;
case FieldState.Planted:
break;
default:
break;
}
}
}
}