diff --git a/Assets/Resources/Chicken.prefab b/Assets/Resources/Chicken.prefab index b791a55..9be2b96 100644 --- a/Assets/Resources/Chicken.prefab +++ b/Assets/Resources/Chicken.prefab @@ -12,8 +12,8 @@ GameObject: - component: {fileID: 3014515124387237889} - component: {fileID: 5993197352764583501} - component: {fileID: 3757590040189918822} - - component: {fileID: 1650281244656501979} - component: {fileID: 9088528460680327735} + - component: {fileID: 7584642645977806350} m_Layer: 0 m_Name: Chicken m_TagString: Untagged @@ -143,26 +143,6 @@ PolygonCollider2D: - {x: -0.03125, y: 0.40625} - {x: -0.25, y: 0.40625} - {x: -0.4375, y: 0.09375} ---- !u!114 &1650281244656501979 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8336664152962957100} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 36cb7b1a78935094f84a770ea77f308c, type: 3} - m_Name: - m_EditorClassIdentifier: - producedItem: {fileID: 11400000, guid: eca7e47128c3e6e4fb93236db4a6324e, type: 2} - movementSpeed: 1 - animalPrefab: {fileID: 8336664152962957100} - defaultSprite: {fileID: 21300000, guid: 1577f106ceccd624895112215c69960a, type: 3} - selectedSprite: {fileID: 21300000, guid: 5cd8e4ccae6b051418872e9b1ca5bb46, type: 3} - displayName: Chicken - description: lays eggs, maybe some eastereggs too - price: 500 --- !u!95 &9088528460680327735 Animator: serializedVersion: 4 @@ -183,3 +163,23 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &7584642645977806350 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8336664152962957100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2ca3402310a920b4a81fc0240a161965, type: 3} + m_Name: + m_EditorClassIdentifier: + producedItem: {fileID: 11400000, guid: eca7e47128c3e6e4fb93236db4a6324e, type: 2} + movementSpeed: 1 + animalPrefab: {fileID: 8336664152962957100} + defaultSprite: {fileID: 21300000, guid: 1577f106ceccd624895112215c69960a, type: 3} + selectedSprite: {fileID: 21300000, guid: 5cd8e4ccae6b051418872e9b1ca5bb46, type: 3} + displayName: Chicken + description: Lays eggs every day. \nMaybe some eastereggs too + price: 500 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 24680f7..13daabb 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -760,56 +760,56 @@ MonoBehaviour: - {fileID: -345647752741578242, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - {fileID: -345647752741578242, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - {fileID: -345647752741578242, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} - - {fileID: 1650281244656501979, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} + - {fileID: 7584642645977806350, guid: 65e8b7a776f555f40a775495903cd7fb, type: 3} --- !u!1 &131335458 GameObject: m_ObjectHideFlags: 0 @@ -2464,8 +2464,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 2006577139} m_HandleRect: {fileID: 2006577138} m_Direction: 2 - m_Value: 1 - m_Size: 0.59851265 + m_Value: 0.9999998 + m_Size: 0.5985127 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -6845,7 +6845,6 @@ MonoBehaviour: m_EditorClassIdentifier: tile: {fileID: 4752245148499717901, guid: ea81011a3ce83fb4386934728a92ee2d, type: 3} cameraGameObject: {fileID: 598358736} - Tiles: [] --- !u!4 &1291863651 Transform: m_ObjectHideFlags: 0 @@ -9750,7 +9749,7 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 18 + m_fontSize: 23.35 m_fontSizeBase: 20 m_fontWeight: 400 m_enableAutoSizing: 1 @@ -10556,7 +10555,7 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 18 + m_fontSize: 23.35 m_fontSizeBase: 20 m_fontWeight: 400 m_enableAutoSizing: 1 diff --git a/Assets/Scripts/Actions/ActionManager.cs b/Assets/Scripts/Actions/ActionManager.cs index c0dd8a3..fb574b5 100644 --- a/Assets/Scripts/Actions/ActionManager.cs +++ b/Assets/Scripts/Actions/ActionManager.cs @@ -43,6 +43,8 @@ namespace Actions { /// private void instantiateNextDayActionHandlers() { _nextDayActionHandlers.Add(new FarmlandTileNextDayActionHandler()); + + _nextDayActionHandlers.Add(new ChickenAnimalNextDayActionHandler()); } diff --git a/Assets/Scripts/Actions/NextDayActionHandlers.cs b/Assets/Scripts/Actions/NextDayActionHandlers.cs index e5c19b4..f7baa97 100644 --- a/Assets/Scripts/Actions/NextDayActionHandlers.cs +++ b/Assets/Scripts/Actions/NextDayActionHandlers.cs @@ -82,7 +82,7 @@ namespace Actions { bool rv = false; try { _animal = gameObject.GetComponent(); - rv = true; + rv = _animal != null; } catch { } diff --git a/Assets/Scripts/Animals.meta b/Assets/Scripts/Animals.meta new file mode 100644 index 0000000..a8829e1 --- /dev/null +++ b/Assets/Scripts/Animals.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5a4be6858d3c4eed8f7ed2e541649875 +timeCreated: 1656052815 \ No newline at end of file diff --git a/Assets/Scripts/Animals/Chicken.cs b/Assets/Scripts/Animals/Chicken.cs new file mode 100644 index 0000000..8b5dc25 --- /dev/null +++ b/Assets/Scripts/Animals/Chicken.cs @@ -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); + } + } +} diff --git a/Assets/Scripts/Animals/Chicken.cs.meta b/Assets/Scripts/Animals/Chicken.cs.meta new file mode 100644 index 0000000..237b117 --- /dev/null +++ b/Assets/Scripts/Animals/Chicken.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2ca3402310a920b4a81fc0240a161965 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Animals/Cow.cs b/Assets/Scripts/Animals/Cow.cs new file mode 100644 index 0000000..6e12acb --- /dev/null +++ b/Assets/Scripts/Animals/Cow.cs @@ -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; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Cow.cs.meta b/Assets/Scripts/Animals/Cow.cs.meta similarity index 100% rename from Assets/Scripts/Cow.cs.meta rename to Assets/Scripts/Animals/Cow.cs.meta diff --git a/Assets/Scripts/Cow.cs b/Assets/Scripts/Cow.cs deleted file mode 100644 index af749ec..0000000 --- a/Assets/Scripts/Cow.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Actions; -using UnityEngine; - -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; - } - } -} \ No newline at end of file