Correction of mistake between Controller and View.

This commit is contained in:
Marc-Antoine Dumont 2015-08-12 11:58:10 -04:00
parent c845b4d18b
commit 9cbd459ec4
2 changed files with 55 additions and 63 deletions

View File

@ -1,15 +1,60 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class RessourceController : MonoBehaviour {
// Use this for initialization
void Start () {
public class RessourceController{
Bank bank;
Text viewWood;
Text viewRock;
Text viewCorpse;
Text viewMeat;
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;
}
// Update is called once per frame
void Update () {
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() + "";
}
}
}

View File

@ -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() + "";
}
}