Merge branch 'dhain' into develop

# Conflicts:
#	Assets/Scripts/Cow.cs
This commit is contained in:
dhain 2022-06-24 08:54:42 +02:00
commit e78fa38433
10 changed files with 140 additions and 110 deletions

View file

@ -43,6 +43,8 @@ namespace Actions {
/// </summary>
private void instantiateNextDayActionHandlers() {
_nextDayActionHandlers.Add(new FarmlandTileNextDayActionHandler());
_nextDayActionHandlers.Add(new ChickenAnimalNextDayActionHandler());
}

View file

@ -82,7 +82,7 @@ namespace Actions {
bool rv = false;
try {
_animal = gameObject.GetComponent<Animal>();
rv = true;
rv = _animal != null;
}
catch { }

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5a4be6858d3c4eed8f7ed2e541649875
timeCreated: 1656052815

View file

@ -0,0 +1,17 @@
using Actions;
namespace Animals {
public class Chicken : Animal {
void Start() {
HouseController.NewDayEvent.AddListener(LayEgg);
}
/**
* Gives a Random amount of eggs to the player
* Directly into the Inventory
*/
private void LayEgg() {
ActionManager.Instance.NextDayAction(gameObject);
}
}
}

View file

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

View file

@ -0,0 +1,31 @@
using Actions;
using UnityEngine;
namespace Animals {
public class Cow : Animal {
private bool _canBeMilked;
private void Awake() {
_canBeMilked = true;
HouseController.NewDayEvent.AddListener(UpdateCanBeMilked);
}
/**
* Update the _canBeMilked bool
*/
private void UpdateCanBeMilked() {
Debug.Log("_ca" + _canBeMilked);
_canBeMilked = true;
}
/**
* Get Milk if cow is able to be milked
*/
private void OnMouseDown() {
if(_canBeMilked) {
ActionManager.Instance.ClickAction(gameObject, PlayerController.instance.SelectedItem);
_canBeMilked = false;
}
}
}
}

View file

@ -1,33 +0,0 @@
using Actions;
using UnityEngine;
public class Cow : Animal {
private bool _canBeMilked;
private void Awake() {
_canBeMilked = true;
HouseController.NewDayEvent.AddListener(NextDay);
}
private void NextDay() {
UpdateCanBeMilked();
//ActionManager.Instance.NextDayAction(gameObject);
}
/**
* Update the _canBeMilked bool
*/
public void UpdateCanBeMilked() {
_canBeMilked = true;
}
/**
* Get Milk if cow is able to be milked
*/
private void OnMouseDown() {
if(_canBeMilked) {
ActionManager.Instance.ClickAction(gameObject, PlayerController.instance.SelectedItem);
_canBeMilked = false;
}
}
}