first commit

This commit is contained in:
Janis
2023-02-12 16:22:41 +01:00
commit 9a4ece1ed4
6445 changed files with 378630 additions and 0 deletions

9
Assets/Scripts/Crop.cs Normal file
View File

@@ -0,0 +1,9 @@
using UnityEngine;
[CreateAssetMenu(fileName = "Crop", menuName = "Harvestdale/Crops", order = 0)]
public class Crop : ScriptableObject
{
public string cropName;
public int daysToGrow;
public bool isHarvestable;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e283aa008f05f1e46b99a7987202ec09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
Assets/Scripts/Field.cs Normal file
View File

@@ -0,0 +1,17 @@
using UnityEngine;
public class Field : MonoBehaviour
{
public Crop crop;
public int daysSincePlanted;
public bool isWatered;
private void Start()
{
TimeManager.OnMinuteChanged += logTime;
TimeManager.OnHourChanged += logTime;
}
public void logTime()
{
Debug.Log($"{TimeManager.Hour:00}:{TimeManager.Minute:00}");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d700e4905ee3fd2408f52a4e3ecb48e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f;
private Rigidbody2D rb;
private Animator animator;
private Vector2 movement;
void Start()
{
rb = GetComponent<Rigidbody2D>();
animator = GetComponent<Animator>();
}
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetFloat("Speed", movement.sqrMagnitude);
}
void FixedUpdate()
{
movement.Normalize();
rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3dc19f09577ba440891c03b861220f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class TimeManager : MonoBehaviour
{
public static Action OnMinuteChanged;
public static Action OnHourChanged;
public static Action OnDayChanged;
public static int Minute { get; private set; }
public static int Hour { get; private set; }
public static int Day { get; private set; }
private float minuteToRealTime = .5f;
private float timer;
private void Start()
{
Minute = 0;
Hour = 10;
Day = 1;
timer = minuteToRealTime;
}
private void Update()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
Minute++;
OnMinuteChanged?.Invoke();
if (Minute >= 60)
{
Hour++;
Minute = 0;
if (Hour >= 24)
{
Day++;
Hour = 0;
OnDayChanged();
}
OnHourChanged();
}
timer = minuteToRealTime;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: efc6be5d380533e4bb0a0179bec47c77
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: