This commit is contained in:
Janis
2023-02-16 17:59:39 +01:00
parent d079eb0b60
commit eb77bd85c0
4999 changed files with 73789 additions and 94339 deletions

View File

@@ -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>();
}

View File

@@ -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);
}
}

View File

@@ -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()