moved Cow.cs and Chicken.cs into Animals Folder
Chicken lays eggs now every day
This commit is contained in:
parent
4a8067d3d7
commit
2d51baacd8
10 changed files with 140 additions and 106 deletions
31
Assets/Scripts/Animals/Cow.cs
Normal file
31
Assets/Scripts/Animals/Cow.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue