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
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ namespace Actions {
|
|||
/// </summary>
|
||||
private void instantiateNextDayActionHandlers() {
|
||||
_nextDayActionHandlers.Add(new FarmlandTileNextDayActionHandler());
|
||||
|
||||
_nextDayActionHandlers.Add(new ChickenAnimalNextDayActionHandler());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace Actions {
|
|||
bool rv = false;
|
||||
try {
|
||||
_animal = gameObject.GetComponent<Animal>();
|
||||
rv = true;
|
||||
rv = _animal != null;
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
|
|
|||
3
Assets/Scripts/Animals.meta
Normal file
3
Assets/Scripts/Animals.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5a4be6858d3c4eed8f7ed2e541649875
|
||||
timeCreated: 1656052815
|
||||
17
Assets/Scripts/Animals/Chicken.cs
Normal file
17
Assets/Scripts/Animals/Chicken.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Animals/Chicken.cs.meta
Normal file
11
Assets/Scripts/Animals/Chicken.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ca3402310a920b4a81fc0240a161965
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue