diff --git a/Assets/Prefab/FoodResource.prefab b/Assets/Prefab/FoodResource.prefab index 16fec162eab2d6bf40554fd1bb489f785de57e43..789afe2a60540df3158d6f818fc7f1575b1386f0 100644 --- a/Assets/Prefab/FoodResource.prefab +++ b/Assets/Prefab/FoodResource.prefab @@ -93,6 +93,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fa5bb155b8732f34994d234d1a214353, type: 3} m_Name: m_EditorClassIdentifier: + resources: 0 + resourceImg: {fileID: 21300000, guid: 4b702e34b5f691f339958a8109caa12a, type: 3} sprites: - {fileID: 21300000, guid: f85d51a973c87b04692395ace7bbb53d, type: 3} - {fileID: 21300002, guid: f85d51a973c87b04692395ace7bbb53d, type: 3} @@ -100,6 +102,7 @@ MonoBehaviour: - {fileID: 21300006, guid: f85d51a973c87b04692395ace7bbb53d, type: 3} - {fileID: 21300008, guid: f85d51a973c87b04692395ace7bbb53d, type: 3} - {fileID: 21300010, guid: f85d51a973c87b04692395ace7bbb53d, type: 3} + coroutineRunning: 0 --- !u!61 &5070108541231774712 BoxCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Resources/BerryBush.cs b/Assets/Scripts/Resources/BerryBush.cs index f708c7e3817ebbcf3b60e5309a94576b6518a1cb..1f60705e743c67096ce774c2449b17d9ad7ae56d 100644 --- a/Assets/Scripts/Resources/BerryBush.cs +++ b/Assets/Scripts/Resources/BerryBush.cs @@ -61,6 +61,7 @@ public class BerryBush : Resource // Start is called before the first frame update void Start() { + setEventType(EventType.Berrypicked); setAmount(500); } diff --git a/Assets/Scripts/Resources/Forest.cs b/Assets/Scripts/Resources/Forest.cs index 8e61b5b483ba33448f573bad481a8a4fc21b47e6..8d733537cfe36c3b06e9d529f52be0544a5ae510 100644 --- a/Assets/Scripts/Resources/Forest.cs +++ b/Assets/Scripts/Resources/Forest.cs @@ -67,7 +67,7 @@ public class Forest : Resource // Start is called before the first frame update void Start() { - + setEventType(EventType.WoodChopped); setAmount(Random.Range(50, 300)); isForester = false; growthspeed = 1; diff --git a/Assets/Scripts/Resources/Outcrop.cs b/Assets/Scripts/Resources/Outcrop.cs index 774c021244f55e65e9397e3011529691edeff523..2b52283acb0ee8c7feca72b1a288b9c6eefb3256 100644 --- a/Assets/Scripts/Resources/Outcrop.cs +++ b/Assets/Scripts/Resources/Outcrop.cs @@ -7,6 +7,8 @@ public class Outcrop : MonoBehaviour { [SerializeField] private int wood; + + private int woodNeeded = 100; private GameObject quarry; @@ -34,6 +36,12 @@ public class Outcrop : MonoBehaviour { setAmount(getAmount() + amount); checkExistence(); + woodNeeded -= getAmount(); + } + + public int stillNeeded() + { + return woodNeeded; } // Start is called before the first frame update diff --git a/Assets/Scripts/Resources/Resource.cs b/Assets/Scripts/Resources/Resource.cs index 0282810cc2c1ab4bf676c3cf36b1df3e654eece8..13a2377c7461a8e878c7a23761fd067faa011033 100644 --- a/Assets/Scripts/Resources/Resource.cs +++ b/Assets/Scripts/Resources/Resource.cs @@ -13,6 +13,18 @@ public abstract class Resource : MonoBehaviour [SerializeField] protected Sprite[] sprites; + private EventType type; + + public void setEventType(EventType e) + { + type = e; + } + + public EventType getEventType() + { + return type; + } + public Sprite getResourceImg() { return resourceImg; @@ -32,6 +44,7 @@ public abstract class Resource : MonoBehaviour public int extractResource(int amount) { + EventSystem.EventHappened(getEventType()); if (resources-amount < 0) { int r = resources; @@ -43,7 +56,6 @@ public abstract class Resource : MonoBehaviour setAmount(resources - amount); return amount; } - } public abstract void refreshSprite();