Skip to content
Snippets Groups Projects
Commit 491830bf authored by Leevi Grönlund's avatar Leevi Grönlund
Browse files

Added resource sounds

parent 123e6b97
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -61,6 +61,7 @@ public class BerryBush : Resource
// Start is called before the first frame update
void Start()
{
setEventType(EventType.Berrypicked);
setAmount(500);
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment