Set up second garden with beetroot, built transition from yard and back
This commit is contained in:
@@ -36,24 +36,35 @@ public partial class PlantBehaviour2D : Node2D
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (_state == PlantState.None)
|
||||
{
|
||||
GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation);
|
||||
_state = PlantState.Planted;
|
||||
_currentPlantSprite = GetRandomSprite(_seeds);
|
||||
_currentPlantSprite.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GrowPlant();
|
||||
}
|
||||
}
|
||||
|
||||
public void Grow()
|
||||
{
|
||||
GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation);
|
||||
_state = PlantState.Planted;
|
||||
_currentPlantSprite = GetRandomSprite(_seeds);
|
||||
_currentPlantSprite.Visible = true;
|
||||
GrowPlant();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Transitions the plant to its next growth stage.
|
||||
/// </summary>
|
||||
public void Grow()
|
||||
public void GrowPlant()
|
||||
{
|
||||
if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded)
|
||||
return;
|
||||
|
||||
// todo: replace with EventBus when possible
|
||||
GetTree().CallGroup("PlantGrowing", VesnaAnimations.MethodName.PlayFarmingAnimation);
|
||||
switch (_state)
|
||||
{
|
||||
case PlantState.None:
|
||||
@@ -63,26 +74,30 @@ public partial class PlantBehaviour2D : Node2D
|
||||
break;
|
||||
case PlantState.Planted:
|
||||
_state = PlantState.SmallPlant;
|
||||
_currentPlantSprite.Visible = false;
|
||||
if(_currentPlantSprite != null)
|
||||
_currentPlantSprite.Visible = false;
|
||||
_currentPlantSprite = GetRandomSprite(_smallPlants);
|
||||
_currentPlantSprite.Visible = true;
|
||||
break;
|
||||
case PlantState.SmallPlant:
|
||||
_state = PlantState.BigPlant;
|
||||
_currentPlantSprite.Visible = false;
|
||||
if(_currentPlantSprite != null)
|
||||
_currentPlantSprite.Visible = false;
|
||||
_currentPlantSprite = GetRandomSprite(_bigPlants);
|
||||
_currentPlantSprite.Visible = true;
|
||||
break;
|
||||
case PlantState.BigPlant:
|
||||
_state = PlantState.Ready;
|
||||
_currentPlantSprite.Visible = false;
|
||||
if(_currentPlantSprite != null)
|
||||
_currentPlantSprite.Visible = false;
|
||||
_currentPlantSprite = GetRandomSprite(_readyPlants);
|
||||
_currentPlantSprite.Visible = true;
|
||||
ActivatePickupAfterDelay(true);
|
||||
break;
|
||||
case PlantState.Ready:
|
||||
_state = PlantState.None;
|
||||
_currentPlantSprite.Visible = false;
|
||||
if(_currentPlantSprite != null)
|
||||
_currentPlantSprite.Visible = false;
|
||||
_currentPlantSprite = null;
|
||||
ActivatePickupAfterDelay(false);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user