mirror of
https://github.com/DerTyp7/harvestdale-unity.git
synced 2025-10-30 21:17:09 +01:00
fix urp
This commit is contained in:
@@ -3,21 +3,43 @@ using UnityEngine.Tilemaps;
|
||||
|
||||
public class Field : Building
|
||||
{
|
||||
public Crop TESTCROP;
|
||||
public Crop crop;
|
||||
|
||||
public SpriteRenderer currentCropSprite;
|
||||
public int daysSincePlanted;
|
||||
public bool isWatered;
|
||||
|
||||
public bool isDead = false;
|
||||
private void Start()
|
||||
{
|
||||
TimeManager.OnDayChanged += AddDay;
|
||||
}
|
||||
private void AddDay()
|
||||
{
|
||||
daysSincePlanted++;
|
||||
if (crop && isPlaced && !isDead)
|
||||
{
|
||||
if (!isWatered)
|
||||
isDead = true;
|
||||
else
|
||||
{
|
||||
daysSincePlanted++;
|
||||
currentCropSprite.sprite = crop.sprites[daysSincePlanted];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Plant(Crop newCrop)
|
||||
{
|
||||
daysSincePlanted = 0;
|
||||
isDead = false;
|
||||
crop = newCrop;
|
||||
}
|
||||
|
||||
public override void OnPlace()
|
||||
{
|
||||
|
||||
daysSincePlanted = 0;
|
||||
isDead = false;
|
||||
Plant(TESTCROP);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user