mirror of
https://github.com/DerTyp7/harvestdale-unity.git
synced 2025-10-30 04:57:09 +01:00
fix urp
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
[CreateAssetMenu(fileName = "Crop", menuName = "Harvestdale/Crops", order = 0)]
|
||||
public class Crop : ScriptableObject
|
||||
{
|
||||
public string cropName;
|
||||
public int daysToGrow;
|
||||
public bool isHarvestable;
|
||||
public List<Sprite> sprites = new List<Sprite>();
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class TimeManager : MonoBehaviour
|
||||
public static int Hour { get; private set; }
|
||||
public static int Day { get; private set; }
|
||||
|
||||
private float minuteToRealTime = .5f;
|
||||
public float minuteToRealTime = .2f;
|
||||
private float timer;
|
||||
|
||||
private void Start()
|
||||
|
||||
Reference in New Issue
Block a user