Added Crop, Farming&Harvesting functionality (no graphics yet!)
This commit is contained in:
parent
b9030174b6
commit
a3a81eeb2a
3 changed files with 101 additions and 3 deletions
44
Assets/Scripts/Crop.cs
Normal file
44
Assets/Scripts/Crop.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
namespace DefaultNamespace
|
||||
{
|
||||
public class Crop
|
||||
{
|
||||
private const int DaysUntilFinished = 4;
|
||||
|
||||
private bool _fullyGrown;
|
||||
public bool FullyGrown => _fullyGrown;
|
||||
|
||||
private bool _markedForDeletion;
|
||||
public bool MarkedForDeletion => _markedForDeletion;
|
||||
|
||||
private int _daysGrown;
|
||||
|
||||
public Crop()
|
||||
{
|
||||
_fullyGrown = false;
|
||||
_markedForDeletion = false;
|
||||
_daysGrown = 0;
|
||||
}
|
||||
|
||||
private void Grow()
|
||||
{
|
||||
_daysGrown++;
|
||||
}
|
||||
|
||||
public void DayLightStep(bool hydrated)
|
||||
{
|
||||
if (_daysGrown >= DaysUntilFinished)
|
||||
{
|
||||
_fullyGrown = true;
|
||||
}
|
||||
|
||||
if (!hydrated)
|
||||
{
|
||||
_markedForDeletion = true;
|
||||
}
|
||||
else if (!_fullyGrown)
|
||||
{
|
||||
Grow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue