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

outcrop changes

parent e40f5f08
Branches
No related tags found
No related merge requests found
...@@ -8,13 +8,13 @@ public class Outcrop : MonoBehaviour ...@@ -8,13 +8,13 @@ public class Outcrop : MonoBehaviour
[SerializeField] [SerializeField]
private int wood; private int wood;
private int woodNeeded = 100; private readonly int woodNeeded = 100;
[SerializeField] [SerializeField]
private GameObject quarry; private GameObject quarry =null;
[SerializeField] [SerializeField]
private Resource neededResource; private Resource neededResource =null;
public Resource getNeededResource() public Resource getNeededResource()
{ {
...@@ -28,12 +28,12 @@ public class Outcrop : MonoBehaviour ...@@ -28,12 +28,12 @@ public class Outcrop : MonoBehaviour
public void setAmount(int amount) public void setAmount(int amount)
{ {
wood += amount; wood = amount;
} }
public void checkExistence() public void checkExistence()
{ {
if (getAmount() >= 100) if (getAmount() >= woodNeeded)
{ {
GameObject go = Instantiate<GameObject>(quarry); GameObject go = Instantiate<GameObject>(quarry);
go.transform.position = this.transform.position; go.transform.position = this.transform.position;
...@@ -45,12 +45,11 @@ public class Outcrop : MonoBehaviour ...@@ -45,12 +45,11 @@ public class Outcrop : MonoBehaviour
{ {
setAmount(getAmount() + amount); setAmount(getAmount() + amount);
checkExistence(); checkExistence();
woodNeeded -= getAmount();
} }
public int stillNeeded() public int stillNeeded()
{ {
return woodNeeded; return woodNeeded-wood;
} }
// Start is called before the first frame update // Start is called before the first frame update
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment