diff --git a/Assets/Controller/RessourceController.cs b/Assets/Controller/RessourceController.cs index f3f619d..62ac7b4 100644 --- a/Assets/Controller/RessourceController.cs +++ b/Assets/Controller/RessourceController.cs @@ -1,15 +1,60 @@ using UnityEngine; using System.Collections; +using UnityEngine.UI; -public class RessourceController : MonoBehaviour { +public class RessourceController{ + Bank bank; + Text viewWood; + Text viewRock; + Text viewCorpse; + Text viewMeat; - // Use this for initialization - void Start () { + public RessourceController(Bank b, Text viewW, Text viewR, Text viewC, Text viewM) + { + this.bank = b; + this.viewCorpse = viewC; + this.viewWood = viewW; + this.viewRock = viewR; + this.viewMeat = viewM; + } + + public void setRock(int nbRock){ + bank.AmountOfRock = nbRock; + } + public int getRock(){ + return bank.AmountOfRock; + } + public void setWood(int nbWood) + { + bank.AmountOfWood = nbWood; + } + public int getWood() + { + return bank.AmountOfWood; + } + public void setCorpse(int nbCorpse) + { + bank.AmountOfCorpse = nbCorpse; + } + public int getCorpse() + { + return bank.AmountOfCorpse; + } + public void setMeat(int nbMeat) + { + bank.AmountOfMeat = nbMeat; + } + public int getMeat() + { + return bank.AmountOfMeat; + } + + public void UpdateView() + { + viewRock.text = ""+ getRock() +""; + viewMeat.text = "" + getMeat() + ""; + viewWood.text = "" + getWood() + ""; + viewCorpse.text = "" + getCorpse() + ""; + } - } - - // Update is called once per frame - void Update () { - - } } diff --git a/Assets/View/RessourceView.cs b/Assets/View/RessourceView.cs index f4918db..56aec85 100644 --- a/Assets/View/RessourceView.cs +++ b/Assets/View/RessourceView.cs @@ -1,60 +1,7 @@ using UnityEngine; using System.Collections; -using UnityEngine.UI; public class RessourceView{ - Bank bank; - Text viewWood; - Text viewRock; - Text viewCorpse; - Text viewMeat; - - public RessourceView(Bank b, Text viewW, Text viewR, Text viewC, Text viewM) - { - this.bank = b; - this.viewCorpse = viewC; - this.viewWood = viewW; - this.viewRock = viewR; - this.viewMeat = viewM; - } - - public void setRock(int nbRock){ - bank.AmountOfRock = nbRock; - } - public int getRock(){ - return bank.AmountOfRock; - } - public void setWood(int nbWood) - { - bank.AmountOfWood = nbWood; - } - public int getWood() - { - return bank.AmountOfWood; - } - public void setCorpse(int nbCorpse) - { - bank.AmountOfCorpse = nbCorpse; - } - public int getCorpse() - { - return bank.AmountOfCorpse; - } - public void setMeat(int nbMeat) - { - bank.AmountOfMeat = nbMeat; - } - public int getMeat() - { - return bank.AmountOfMeat; - } - - public void UpdateView() - { - viewRock.text = ""+ getRock() +""; - viewMeat.text = "" + getMeat() + ""; - viewWood.text = "" + getWood() + ""; - viewCorpse.text = "" + getCorpse() + ""; - } + }