Skip to content
Snippets Groups Projects
Commit 23aef899 authored by Petteri's avatar Petteri
Browse files

outcrop changes

parent e40f5f08
No related branches found
No related tags found
No related merge requests found
......@@ -8,13 +8,13 @@ public class Outcrop : MonoBehaviour
[SerializeField]
private int wood;
private int woodNeeded = 100;
private readonly int woodNeeded = 100;
[SerializeField]
private GameObject quarry;
private GameObject quarry =null;
[SerializeField]
private Resource neededResource;
private Resource neededResource =null;
public Resource getNeededResource()
{
......@@ -28,12 +28,12 @@ public class Outcrop : MonoBehaviour
public void setAmount(int amount)
{
wood += amount;
wood = amount;
}
public void checkExistence()
{
if (getAmount() >= 100)
if (getAmount() >= woodNeeded)
{
GameObject go = Instantiate<GameObject>(quarry);
go.transform.position = this.transform.position;
......@@ -45,12 +45,11 @@ public class Outcrop : MonoBehaviour
{
setAmount(getAmount() + amount);
checkExistence();
woodNeeded -= getAmount();
}
public int stillNeeded()
{
return woodNeeded;
return woodNeeded-wood;
}
// Start is called before the first frame update
......
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